Issue
I'm trying to play with Java11 APIs in android application and failed to make it compile.
Steps to fail:
- Using current version of Android Studio 4.1.2 - generated dummy project "Basic Activity"
- Build & Launch - everything OK so far
- Open
app/build.gradle
and setsourceCompatibility JavaVersion.VERSION_11
+targetCompatibility JavaVersion.VERSION_11
- In Project Structure > SDK Location > JDK Location - select path to JDK 11
- 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
?
Solution
Just switch to the latest version Android Studio Arctic Fox Canary 9 (2020.3.1.9) and AGP 7.0
Answered By - sdex
Answer Checked By - Timothy Miller (JavaFixing Admin)