I am trying to build an android app with some dependencies compiled in java 11.
I have configured this in the build.gradle :
android {
compileOptions {
sourceCompatibility = 1.11
targetCompatibility = 1.11
}
...
}
And I have configured my project structure with the java 11 sdk.
I am using this version of the android tool build plugin :
classpath 'com.android.tools.build:gradle:3.5.3'
And this version of gradle :
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
I am also pointing to java 11 for the Gradle JVM.
But when I compile the app, I always get this error :
Execution failed for task ':app:compileDevJavaWithJavac'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'.
I do not understand why.
I have checked my JAVA_HOME and my java -version and they both point to 11.
Does anybody has an idea of what is going on ?
Thanks
Try like this :
compileOptions {
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_11
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With