EAS build fails for android with errors regarding react-native-gesture-handler and react-native-reanimated

Hi,

I just tried to use EAS build the first time and I got stuck with this error. Using sdk 44.0.0:

Running './gradlew :app:bundleRelease' in /root/workingdir/build/frontend/apps/app/android
Downloading https://services.gradle.org/distributions/gradle-6.9-all.zip
Unzipping /root/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9-all.zip to /root/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9/bin/gradle
Welcome to Gradle 6.9!
Here are the highlights of this release:
 - This is a small backport release.
 - Java 16 can be used to compile when used with Java toolchains
 - Dynamic versions can be used within plugin declarations
 - Native support for Apple Silicon processors
For more details see https://docs.gradle.org/6.9/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.9/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
> Configure project :expo
Using expo modules
  - @unimodules/core (7.2.0)
  - expo-application (4.0.1)
  - expo-constants (13.0.0)
  - expo-file-system (13.1.0)
  - expo-font (10.0.4)
  - expo-keep-awake (10.0.1)
  - expo-modules-core (0.4.10)
  - expo-screen-orientation (4.1.1)
  - expo-secure-store (11.1.0)
  - expo-sensors (11.1.0)
  - expo-splash-screen (0.14.1)
  - react-native-reanimated (2.3.1)
[stderr] FAILURE: Build failed with an exception.
[stderr] * Where:
[stderr] Build file '/root/workingdir/build/frontend/node_modules/react-native-gesture-handler/android/build.gradle' line: 26
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':react-native-gesture-handler'.
[stderr] > /root/workingdir/build/frontend/apps/app/android/../node_modules/react-native-reanimated/package.json (No such file or directory)
[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 59s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.

Locally I can see that node_modules/react-native-gesture-handler/android/build.gradle contains these line around line 26, which is reported in the error:

// Check whether Reanimated 2.3 or higher is installed alongside Gesture Handler
def shouldUseCommonInterfaceFromReanimated() {
    if (rootProject.subprojects.find { it.name == 'react-native-reanimated' } != null) {
        def inputFile = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/package.json')
        def json = new JsonSlurper().parseText(inputFile.text)
        def reanimatedVersion = json.version as String
        def (major, minor, patch) = reanimatedVersion.tokenize('.')
        return Integer.parseInt(minor) >= 3
    } else {
        return false
    }
}

I can also see that ../node_modules/react-native-reanimated/package.json does exists locally.

Any idea what could go wrong here?

Removing react-native-gesture-handler solved it for now.

are you working in a monorepo? there was a regression in reanimated support for monorepos in their latest release. you could work around it by symlinking reanimated and react-native-gesture-handler to node_modules in the app directory

Yes, I use monorepo. Thanks for the hint, indeed it seems like a reanimated bug:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.