I got a warning while I compile it tells me :
> Task :app:compileDebugJavaWithJavac
warning: C:\Users\bleuc\AppData\Local\Android\Sdk\build-tools\30.0.1\core-lambda-
stubs.jar(java/lang/invoke/LambdaMetafactory.class): major version 53 is newer than 52, the highest
major version supported by this compiler.
It is recommended that the compiler be upgraded.
C:\Users\bleuc\AppData\Local\Android\Sdk\build-tools\30.0.1\core-lambda-
stubs.jar(java/lang/invoke/LambdaMetafactory.class): major version 53 is newer than 52, the highest
major version supported by this compiler.
1 warning
How can I resolve this? I'm using android studio.
In my module:app
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
I know 53 is java 9 so I tried to pout 1_9 but it shows me so much errors.
Up! I don't know how to correct this on Android studio
Well, i updated my buildToolsVersion in build.gradle
(app level, eg Module: YourApp.app) "30.0.2" and the warning disapeard.
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.app"
minSdkVersion 20
targetSdkVersion 30
versionCode 1
versionName "0.0.1"
}
...
}
Let's take Windows as an example, if your OS's JRE is Java 8 (52), while your program is complied in Java 14 (58), you will face a similar error. However, if you specify the program to run with JDK 14 binary, it will run normally.
In short, check what your system default JRE is, if it's older than the one you use to compile, you will have this error. Note that you might not face any issue in IDE since you set your IDE to use newer version of JRE.
Make sure to properly associate the .jar file with the supported JRE, so it will you the correct JRE to run the executable.
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.