1

Recently I've been having problems successfully running an android build on Expo. See this copy paste of the error here:

w: FAILURE: Build failed with an exception.994[stderr] * What went wrong:995[stderr] Execution failed for task ':expo-permissions:compileReleaseJavaWithJavac'.996[stderr] > Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'.997[stderr] * Try:998[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.999[stderr] * Get more help at https://help.gradle.org1000[stderr] BUILD FAILED in 5m 41s1001

I’ve researched a bit and found these two topics: expo eas build failing Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)' Execution failed for task ':expo-permissions:compileDebugKotlin' Unfortunately many proposed solutions didn’t make any difference, so I’m almost reaching a point where I don’t know what to do :disappointed: My assumption is that there might be some version mismatch between expo and its submodules, but that’s just a guess.

Does someone has an idea what might go wrong here?

I’ve spent some time to sort out the issue, and I noticed that the following properties in build.gradle were set to Java version 1.8 after running expo eject:

```compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}```

In the expo docs I’ve found config to set some build tools version (https://docs.expo.dev/versions/latest/sdk/build-properties/#configuration-in-appjson--appconfigjs)>

Is there a way to reproduce this situation without pushing the build to expo? I’ve tried to run something like ./android/gradlew installRelease, but not entirely sure if it does the same as on Expo.dev

Mauro
  • 11
  • 2

1 Answers1

0

You need to update the version of expo-permissions package, as you can see here https://github.com/expo/expo/blob/main/packages/expo-permissions/CHANGELOG.md#1320--2022-04-18 it was fixed in version 13.2.0

Here more details and your error: https://github.com/expo/expo/pull/16941

Kirill Novikov
  • 2,576
  • 4
  • 20
  • 33
  • Thank you for the quick response! I have updated the expo-permissions package, but it still shows me the error. I'm sure it might be related to my settings in build.gradle: `compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }` (see my updated question above). Do you know if I should set the required versions in app.json? I might need to add this config, but adding expo-build-properties in app.json results in an error: Cannot find module 'expo/config-plugins – Mauro Dec 12 '22 at 16:04
  • remove it from your build.gradle – Kirill Novikov Dec 12 '22 at 16:21
  • I've removed it from my build.gradle, but for some reason my builds still won't proceed. Based on the logs this error is the most prominent: "Class 'kotlin.Unit' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.4.1" Could it be that my combination of versions is not working properly? For example: I'm running Expo 43 and react native v 0.64.3 – Mauro Dec 21 '22 at 16:35