react-nativegradleexpo

EAS Build fails with "cannot find symbol: class ExpoModulesPackage" error after adding project dependencies


I'm building an Expo app using EAS Build. A fresh Expo app builds successfully to APK, but when I add my project's dependencies, the build fails with the following error:

> Task :react-native-reanimated:buildCMakeRelWithDebInfo[arm64-v8a][reanimated,worklets]
[Incubating] Problems report is available at: file:///home/expo/workingdir/build/android/build/reports/problems/problems-report.html
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.13/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
604 actionable tasks: 603 executed, 1 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler output below.
  /home/expo/workingdir/build/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:14: error: cannot find symbol
  import expo.core.ExpoModulesPackage;
                  ^
    symbol:   class ExpoModulesPackage
    location: package expo.core
  /home/expo/workingdir/build/android/app/build/generated/autolinking/src/main/java/com/facebook/react/PackageList.java:74: error: cannot find symbol
        new ExpoModulesPackage(),
            ^
    symbol:   class ExpoModulesPackage
    location: class PackageList
  2 errors
* Try:
> Check your code and dependencies to fix the compilation error(s)
> Run with --scan to get full insights.
BUILD FAILED in 5m 5s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

What I've Tried

✅ Fresh Expo app builds successfully ❌ Adding my project dependencies causes the build to fail ✅ Verified all dependencies are compatible with Expo SDK 53 ❌ Issue persists after clearing cache and reinstalling dependencies


Solution

  • I found the solution: I just needed to switch to npm by deleting node_modules and pnpm-lock file then run npm i --legacy-peer-deps . After that, I rebuilt the app.