Xtra Coder
Xtra Coder

Reputation: 3497

android + sourceCompatibility JavaVersion.VERSION_11: error: package android.os does not exist

I'm trying to play with Java11 APIs in android application and failed to make it compile.

Steps to fail:

  1. Using current version of Android Studio 4.1.2 - generated dummy project "Basic Activity"
  2. Build & Launch - everything OK so far
  3. Open app/build.gradle and set sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11
  4. In Project Structure > SDK Location > JDK Location - select path to JDK 11
  5. Build ... and it fails with following error
FirstFragment.java:3: error: package android.os does not exist

So the question is - what am I doing wrong? What is missing to build the project with sourceCompatibility JavaVersion.VERSION_11?

Upvotes: 5

Views: 8136

Answers (1)

sdex
sdex

Reputation: 3778

Just switch to the latest version Android Studio Arctic Fox Canary 9 (2020.3.1.9) and AGP 7.0

Upvotes: 2

Related Questions