I am using the latest Android Studio Arctic Fox 2020.03.01 Canary 8 and AGP 7, and I want to convert my project to use Java 11. Apparently just doing the following does not work as mentioned on https://developer.android.com/studio/preview/features#use-java-11:
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "11"
}
}
I get the following error when I build:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':app:androidJdkImage'.
> Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JdkImageTransform: /Users/azfarsiddiqui/Library/Android/sdk/platforms/android-30/core-for-system-modules.jar.
> jlink executable /Applications/Android Studio Preview.app/Contents/jre/jdk/Contents/Home/bin/jlink does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
To keep it simple, I've been trying this on a Jetpack Compose sample project here: https://github.com/android/compose-samples/tree/main/JetNews
Any thoughts? Thanks guys