I want to use JDK 8 in my project, but in Android Studio 4.2.1 I can't choose JDK 8 when selecting a menu item "JDK Location". A window is displayed with the message: "Please choose a valid JDK11 directory".
You can still work in Android Studio 4.2
with Java 8.
For that you don't need to change JDK
just set Java 8 compability in app/build.gradle
file
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
UPDATE
add following dependencies to app/build.gradle
dependencies {
// JAX-B dependencies for JDK 9+
implementation "jakarta.xml.bind:jakarta.xml.bind-api:2.3.2"
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
}
you can uninstall your jdk11 and install JDK 8 for that project to set and finally upgrade the protect to the new version with java 11 codes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.