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.

You can define a different image in your eas.json (Build schema for eas.json - Expo Documentation), the default image is still on Java 8, but the latest image supports Java 11, you can find the details for the images here: Build server infrastructure - Expo Documentation.

For example:

{
  "build": {
    "MY_PROFILE": {
      "android": {
        "image": "latest"
      }
    }
  }
}

Setting property “image” to “latest” solved my problem. Latest image at that time was “ubuntu-22.04-jdk-11-ndk-r21e”. Everything was working.

Few days later eas build switched android image to “ubuntu-18.04-jdk-11-ndk-r19c” and new problem accurred. Android app started to crash right after launch. Setting property “image” to different value did not help, bcs eas build is still using “ubuntu-18.04-jdk-11-ndk-r19c".

Runtime error message. E/EmbeddedManifest: Could not read embedded manifest

@kbrandwijk Do you have any idea where is the problem?