EAS Android internal build - Gradle fail

Hi,

I am trying to build Android apk with EAS, but still getting this error in Expo:

w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
Execution optimizations have been disabled for 6 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
964 actionable tasks: 964 executed
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.


  • What went wrong:
    Execution failed for task ‘:app:compileReleaseJavaWithJavac’.
    Compilation failed; see the compiler error output for details.
  • Try:
    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.
    ==========================================================================
    2: Task failed with an exception
  • What went wrong:
    java.lang.StackOverflowError (no error message)
  • Try:
    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.
    ==========================================================================

My Expo SDK is: 48.0.0
EAS version: 3.14.0

Running nxp expo-doctor I’ve got this result:

npx: installed 1 in 2.649s
:heavy_multiplication_x: Check package.json for common issues
:heavy_check_mark: Validate global prerequisites versions
:heavy_check_mark: Validate Expo Config
:heavy_multiplication_x: Check for incompatible packages
Unexpected error while running ‘Check for incompatible packages’ check:
Error: Dependency tree validation for react-native-unimodules failed. This validation is only available on Node 16+ / npm 8.
:heavy_multiplication_x: Check for conflicting global packages in project
Unexpected error while running ‘Check for conflicting global packages in project’ check:
Error: Dependency tree validation for expo-cli failed. This validation is only available on Node 16+ / npm 8.
:heavy_multiplication_x: Verify prebuild support package versions are compatible
Unexpected error while running ‘Verify prebuild support package versions are compatible’ check:
Error: Dependency tree validation for expo-modules-autolinking failed. This validation is only available on Node 16+ / npm 8.
:heavy_multiplication_x: Check compatible dependency versions for the installed Expo SDK
Detailed check results:
Some dependencies are incompatible with the installed expo version:
react-native-async-storage/async-storage-1.19.0 - expected version: 1.17.11
react-native-community/netinfo-9.4.1 - expected version: 9.3.7
react-native0.71.4 - expected version: 0.71.8
react-native-gesture-handler-2.12.0 - expected version: ~2.9.0
react-native-safe-area-context-4.6.3 - expected version: 4.5.0
react-native-screens-3.22.0 - expected version: ~3.20.0
react-native-svg-13.9.0 - expected version: 13.4.0
babel/core-7.13.8 - expected version: ^7.20.0
types/react-dom17.0.1 - expected version: ~18.0.10
typescript5.0.4 - expected version: ^4.9.4
Your project may not work correctly until you install the correct versions of the packages.
Install individual packages by running npx expo install react-native-async-storage/async-storage 1.17.11 react-native-community/netinfo 9.3.7 react-native0.71.8 react-native-gesture-handler~2.9.0 react-native-safe-area-context 4.5.0 react-native-screens~3.20.0 react-native-svg13.4.0 babel/core^7.20.0 types/react-dom~18.0.10 typescript^4.9.4
Found outdated dependencies
Advice: Use ‘npx expo install --check’ to review and upgrade your dependencies.The following scripts in package.json conflict with the contents of node_modules/.bin: build-storybook.
One or more checks failed, indicating possible issues with the project.

I don’t have installed neither of react-native-unimodules, expo-cli, expo-modules-autolinking.
Right now, i am using node 14.21.2 and its not possible to upgrade to Node 16+.

But my question is, if that is really the issue, why the build is failing.

Can you please help me to find a solution for it.

Thank you

I have a same error , please help…

1 Like

you are seeing this error because you have some incompatible dependency versions. look carefully at your logs to see where it omes from.

likely one of these packages:

:heavy_multiplication_x: Check compatible dependency versions for the installed Expo SDK
Detailed check results:
Some dependencies are incompatible with the installed expo version:
react-native-async-storage/async-storage-1.19.0 - expected version: 1.17.11
react-native-community/netinfo-9.4.1 - expected version: 9.3.7
react-native0.71.4 - expected version: 0.71.8
react-native-gesture-handler-2.12.0 - expected version: ~2.9.0
react-native-safe-area-context-4.6.3 - expected version: 4.5.0
react-native-screens-3.22.0 - expected version: ~3.20.0
react-native-svg-13.9.0 - expected version: 13.4.0
babel/core-7.13.8 - expected version: ^7.20.0
types/react-dom17.0.1 - expected version: ~18.0.10
typescript5.0.4 - expected version: ^4.9.4

Hi @matkobiely

The real error details are usually further up in the logs. It should say something like:
Task :app:xxx FAILED

The warnings about multiple Kotlin daemon sessions, deprecated Gradle features and optimizations being disabled can be ignored.

Why not? :slight_smile:

You could install it in your home directory instead of globally if that’s the issue.

But if it’s just a problem with expo-doctor then you can check the expo-doctor logs on the build page.

While it might work to use “unexpected versions” of those dependencies, they have not been tested. So if you’re having problems it would be best to run:

npx expo install --fix

For react-native-unimodules, check the expo doctor logs from your last build.
For expo-cli, if you don’t have it listed in package.json then that’s fine.
For expo-modules-autolinking, it should not be installed manually, but other Expo modules depend on it, so it gets installed that way.

If npx expo install --fix doesn’t fix it, maybe post your dependencies and devDependencies from package.json.

About that task fail, here is the output:

> Task :app:compressReleaseAssets
> Task :app:mergeReleaseArtProfile
> Task :app:processReleaseJavaRes NO-SOURCE
> Task :app:processReleaseResources
> Task :app:compileReleaseJavaWithJavac FAILED

/home/expo/workingdir/build/react/apps/shopvox-go-v1.2/android/app/src/main/java/com/matkobiely/shopvoxgov12/android/MainActivity.java:19: error: package R does not exist
    setTheme(R.style.AppTheme);

With many other Java issues.

1 Like

Do you have an android directory in your app? If so you are on the Bare workflow.

If you did not intend to be on the Bare workflow, you can switch back to the managed workflow by deleting the android directory (and also ios), as long as you did not make changes to the native projects that you still want to keep.

If you do intend to use the Bare workflow, then you could try making a note of the changes you made to the android directory and then do this:

  • Run npx expo prebuild --platform android --clean to regenerate the android directory
  • Redo your changes to the native Android project

If you do not currently have an android directory, please post your dependencies and devDependencies from package.json.

I am not on Bare workflow, i use managed workflow.

Are you looking for something specific in package.json? Because i use monorepo so the list is longer and i think not all of packages are relevant.

So you don’t have an android directory? :slight_smile: The reason I ask is because it’s not uncommon for someone to believe they are on the Managed workflow, but they have an android directory because e.g. they ran npx expo run:android.

I’m not looking for something specific. Just something that jumps out at me as being potentially problematic. I suspect there’s some sort of conflict between some of your dependencies.

If I didn’t see anything problematic I would try creating a new app, installing all of the dependencies and then building. If you get the same error, try doing a binary search to find the problematic combination of dependencies. (i.e. remove half of them. If it still fails, then the problem is probably to do with the half that you still have installed. If the problem goes away, then the problem is probably in the ones you removed. Then remove half of the ones you believe the problem comes from to find out which of those might be causing this. etc.)

If you are able to find a combination of dependencies that is causing problems then it will be easier to figure out how to fix it.

I am using managed workflow you can trust me :slight_smile: I do not have any android package and I even never run Android app.

I tried to create new, not depended on monorepo app, managed workflow but now I am getting this error:
[stderr]

FAILURE: Build failed with an exception.

* Where:

Settings file '/home/expo/workingdir/build/react/apps/xyz/android/settings.gradle' line: 10
* What went wrong:

A problem occurred evaluating settings 'xyz'.
> path may not be null or empty string. path='null'
* Try:
> 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s

On internet i found this is kind of general error and not specific to any particular error. So in this point, i am not able to build it either way.

Maybe try:

npx expo prebuild -p android

This will generate the native android project and apply any config plugins etc.
Then check line 10 of android/settings.gradle to see what might be wrong with it.

Here is the line 10, but not sure, what could go wrong.
Similar lines are above and it looks like they are okay (i assume by the error log)
Only difference is package @react-native/gradle-plugin/package.json

9: include ':app'  
10: includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

hmmm… if I create a new Expo SDK 49 app and run npx expo prebuild then my android/settings.gradle looks like this:

$ cat -n android/settings.gradle 
     1	rootProject.name = 'testapp'
     2	
     3	apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
     4	useExpoModules()
     5	
     6	apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
     7	applyNativeModulesSettingsGradle(settings)
     8	
     9	include ':app'
    10	includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

I’m not sure why yours would be different. I tried downgrading react-native to 0.71.4 based on this from your initial post:

but the result was the same.

Well, i have the same setting, I just posted line n.9 and n.10.

No. They’re different

Yours vs. mine:

includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())
includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

Ou, yeah, i didn’t noticed it.
Do you have any idea why it is happening? Is there a way how can i fix it?

My SDK 49.0.3, RN 0.71.8

Ah sorry. I made the assumption that running yarn create expo-app more than a week after the release of Expo SDK 49 would result in an Expo SDK 49 app. I just checked now and I see it was Expo SDK 48. If I upgrade it to Expo SDK 49 then I get the same as you:

$ cat -n android/settings.gradle | tail -n1
    10	includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile())

But the app builds for me.

Can you try just creating a new Expo SDK 49 app with just the default App.js and no extra dependencies and make sure that builds. Then add all of the dependencies (but still with only the default App.js) and see if it builds. If it does not, try half of the dependencies. Depending on whether it builds after that, try the other half of the dependencies or half of the original half, etc.

Unfortunately the error you’re getting doesn’t give you enough information to know what’s wrong, so if I were you I would do a bisection search on your dependencies.

Is there any fix for this? I’m currently facing this issue

If you create a new Expo SDK 49 app, does it build OK?

What if you install half of the dependencies from your real app? Does it still build?
What about the other half of the dependencies?

I fixed this error, by doing this steps:

  • removed android, ios folders.

  • yarn android

this generated android folder again and fixed the problem.

If that worked for you, then you could also have just deleted the android and ios directories and stuck with the managed workflow.