'React Native Expo eas build -p android has wrong java JDK version
Running eas build -p android yields the following:
stderr] FAILURE: Build failed with an exception.
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/android/app/build.gradle' line: 1
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':app'.
[stderr] > Failed to apply plugin 'com.android.internal.application'.
[stderr] > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
[stderr] You can try some of the following options:
[stderr] - changing the IDE settings.
[stderr] - changing the JAVA_HOME environment variable.
[stderr] - changing `org.gradle.java.home` in `gradle.properties`.
[stderr] * Try:
[stderr] 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.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 40s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
I see no where to upgrade my java jdk version from within the android folder of my expo managed project, and the current version 1.8 does not appear to be listed anywhere. The build is running on eas servers, so I doubt pointing to a local JDK path is going to do anything.
Solution 1:[1]
I had the same error as well. The following solution fixed the Java 11 vs 8 issue for me, but I am now running into another error - Could not create task ':app:prepareLintJarForPublish'.
Look here for more info. Turns out the eas default is to use jdk 8.
Solution:
Add this to your eas.json file
"production": {
"android": {
"image" : "latest"
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
