I am wotking on multi-module Android project, currently this project is using Java 8 and as part of requirement I am upgrading this project to Java 11. Below is what I tried so far to achive the same-
1] Installed JDK-11 and set JDK location pointing to java-11 (i.e. File --> Project Structure --> SDK Location --> JDK Location)
2] As it is multi-module project, I did below chages in all module-level build.gradle files-
android{
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
}
Then I am able to Sync and Build the project successfully, but when I'm trying to run the project, I'm getting "error: package android.view does not exist" error and some other related errors, please check below screenshot for more details--
I goolged this error and found couple of related posts on Stackoverflow (below are the links) but haven't found any concrete solution yet.
1] error: package android.view does not exist
2] Migrating Java 8 project to Java 11
3] android + sourceCompatibility JavaVersion.VERSION_11: error: package android.os does not exist
- Important: I am using Android-Studio Version 4.1.2 and MacBook with macOS Big Sur
Also, please let me know in-case any other details required. Thank you!