SDK 42 new managed project fails to build on EAS for Android
Summary
Build fails from a fresh project to build for EAS Android
Environment
EAS CLI 0.27.1 environment info: System: OS: macOS 11.4 Shell: 5.8 - /bin/zsh Binaries: Node: 14.6.0 - /usr/local/bin/node npm: 6.14.13 - /usr/local/bin/npm Utilities: Git: 2.31.1 - /usr/local/bin/git npmPackages: expo: ~42.0.1 => 42.0.3 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: eas-cli: 0.27.1
Error output
In Gradle build:
[stderr] * What went wrong: [stderr] Execution failed for task ':app:mergeDebugNativeLibs'. [stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade [stderr] > More than one file was found with OS independent path 'lib/x86/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake [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
Reproducible demo or steps to reproduce from a blank project
- Expo init - managed blank project, SDK42
- Create git directory / git repository
- eas build:configure
- eas build -p android --profile development
- See build fail
~~We also have this problem. But if I read the release notes correctly this is an anticipated issue?~~
Apologies, our related issue is with eas submit, I'll create a new ticket
@DomVinyard where did you see it referenced in release notes? Couldn't find it...did you find a solution to how to fix it?
Me too - same issue. Been driving me nuts. Any intel on this - looking in the release notes can't see anything...?
I'm getting this error both through eas build -p android and locally through eas build -p android --local, but expo run:android seems to still work
For what it's worth, retrying a build run with eas build -p android that passed on 2021-09-09 14:00 UTC (4 days ago) is now yielding the same error (just :app:mergeReleaseNativeLibs rather than :app:mergeDebugNativeLibs) despite having no changes. Upgrading all npm dependencies including eas-cli and running expo upgrade does not fix the problem.
Edit: Workaround below fixed the problem.
I tried following the source code of the --local flag that was also failing, but replicating those steps manually I couldn't get it to fail. It seems to be a expo prebuild -p android in a temp folder followed by ./gradlew bundleRelease, but that seems to succeed.
In the meantime because I can still build locally I can submit those bundle to the app store, but looks like any builds through the eas-cli are failing for android.
we are working on a fix, temporary workaround, is to explicitly install react-native-reanimated version 2.2.0, please use the exact version because 2.2.1 will cause that build failure
@wkozyra95 even if you don't have react-reanimated installed? It's a required package due to this bug?
that package and few others are always added in managed workflow on eas, if it's not installed it's added on the fly by the build service
currently by default, we are adding
- react-native-reanimated
- expo-splash-screen
- expo-updates
- react-native-gesture-handler
- react-native-screens
- react-native-unimodules
That's fixed it for me - thanks
We also started seeing builds that previously worked starting to fail (no changes to package-lock.json)
[stderr] FAILURE: Build failed with an exception. [stderr] * What went wrong: [stderr] Execution failed for task ':app:mergeReleaseNativeLibs'. [stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade [stderr] > More than one file was found with OS independent path 'lib/x86_64/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake [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 11m 14s
Pinning react-native-reanimated to 2.2.0 fixes the problem...
that package and few others are always added in managed workflow on eas, if it's not installed it's added on the fly by the build service
This is a bit alarming? It means that even if you have a package-lock.json file the build will potentially use different dependencies? 🤔
What is the reasoning for always including e.g. reanimated? And is the list of this packages provided in a convenient way somewhere, like the native modules are (you can do import bundledNativeModules from 'expo/bundledNativeModules.json'), so that one can setup a test that makes sure that all of these dependencies are always in ones package.json file?
e.g. we currently have this test:
import bundledNativeModules from 'expo/bundledNativeModules.json'
import pkg from '../package.json'
test('Native dependencies matches Expo list', async () => {
const dependencies: Record<string, string> = pkg.dependencies
const devDependencies: Record<string, string> = pkg.devDependencies
for (const key of (Object.keys(bundledNativeModules) as Array<keyof typeof bundledNativeModules>)) {
if (dependencies[key] != null) {
expect(`${key}@${dependencies[key]}`).toEqual(`${key}@${bundledNativeModules[key]}`)
}
if (devDependencies[key] != null) {
expect(`${key}@${devDependencies[key]}`).toEqual(`${key}@${bundledNativeModules[key]}`)
}
}
})
@LinusU - packages like reanimated are included because they require additional configuration that doesn't live in a config plugin at the moment. you can see the list here: https://github.com/expo/expo/blob/sdk-42/templates/expo-template-bare-minimum/package.json. the dependencies are updated during prebuild- you can run it locally to see the output. we're working towards moving away from modifying dependencies at all, and have made some progress towards that in upcoming sdk 43.
the issue is now fixed, if you added reanimated to your package json it can be removed, but you can also keep that version if you want to have control over those packages
if your builds are still failing locally(using eas build --local), clearing npm/yarn cache might be required
Thank you for the detailed explanation!
the issue is now fixed, if you added reanimated to your package json it can be removed, but you can also keep that version if you want to have control over those packages
Was this fixed in a way that we can update our own package-lock.json to point at reanimated 2.2.1? Or was it fixed by pinning it to 2.2.0 in the automatic installation?
Was this fixed in a way that we can update our own package-lock.json to point at reanimated 2.2.1? Or was it fixed by pinning it to 2.2.0 in the automatic installation?
reanimated released new version 2.2.2 with a fix. If you want to pin that version you can do this in package.json (if the package is explicitly installed we are not overriding it)
Great, thanks!
Is it something you guy are planning to upgrade on EAS managed flow to react-native-reanimated to v2.2.2
@idanwe - you will need to update it in your project if you are already using [email protected]
and if you are not using reanimated, then it was using the latest, so it was updated to 2.2.2 immediately after that version was released
Looks like this bug might've been reintroduced. I'm using sdk 42 and tried the suggested fixes of pinning react-native-reanimated, which we're using in our project, to 2.2.2 and also 2.2.3 with no success.
Someone else posted about it in the forums here: https://forums.expo.dev/t/build-fails-when-using-eas-but-expo-build-works-fine/60232
Here's my environment info:
EAS CLI 0.42.4 environment info:
System:
OS: macOS 12.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.1 - /usr/local/bin/node
npm: 8.2.0 - /usr/local/bin/npm
Utilities:
Git: 2.21.0 - /usr/local/bin/git
npmGlobalPackages:
eas-cli: 0.42.4
expo-cli: 5.0.1
Project workflow: managed
The bug I'm seeing in EAS failed build for android:
> Task :app:mergeDebugNativeLibs FAILED
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:mergeDebugNativeLibs'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[stderr] >
[stderr] More than one file was found with OS independent path 'lib/x86_64/libturbomodulejsijni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake
[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 5m 22s
Thanks and Happy Holidays!
@wkozyra95 please let me know if I should create a new issue for this.