Build error on android after upgrading to expo 45

I just upgraded my app from expo 44 to 45 and getting this error on android:

Build file '/Users/lm/Projects/xxx/node_modules/expo/android/build.gradle' line: 39

A problem occurred evaluating project ':expo'.
> Project with path ':expo-modules-core' could not be found in project ':expo'.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':expo'.
	at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:111)
	at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)
	at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)
	at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)
    ...

Any ideas how to fix this?

Hi @levani

Could you post your dependencies? Also, is this a managed or bare app?

@wodin hey,

It’s bare app.

List of dependencies from package.json

"dependencies": {
    "@expo/react-native-action-sheet": "^3.8.0",
    "@notifee/react-native": "^4.0.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-native-community/hooks": "^2.6.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "8.2.0",
    "@react-native-firebase/analytics": "^14.5.1",
    "@react-native-firebase/app": "^14.5.1",
    "@react-native-firebase/messaging": "^14.5.1",
    "@react-navigation/drawer": "^5.9.3",
    "@react-navigation/native": "^5.7.6",
    "@react-navigation/stack": "^5.9.3",
    "@sentry/react-native": "^3.2.0",
    "axios": "^0.26.0",
    "date-fns": "^2.16.1",
    "deepmerge": "^4.2.2",
    "dotenv": "^16.0.0",
    "expo": "^45.0.0",
    "expo-app-loading": "~2.0.0",
    "expo-application": "~4.1.0",
    "expo-constants": "~13.1.1",
    "expo-device": "~4.2.0",
    "expo-document-picker": "~10.2.1",
    "expo-font": "~10.1.0",
    "expo-google-sign-in": "~10.2.0",
    "expo-image-picker": "~13.1.1",
    "expo-linear-gradient": "~11.3.0",
    "expo-linking": "~3.1.0",
    "expo-modules-core": "~0.9.2",
    "expo-print": "~11.2.0",
    "expo-secure-store": "~11.2.0",
    "expo-sharing": "~10.2.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.2",
    "formik": "^2.2.0",
    "i18next": "^19.8.3",
    "memory-cache": "^0.2.0",
    "mobx": "^6.0.3",
    "mobx-react-lite": "3.1.0",
    "pinar": "^0.11.0",
    "pretty-bytes": "^5.6.0",
    "promise.allsettled": "^1.0.5",
    "react": "17.0.2",
    "react-content-loader": "^6.1.0",
    "react-dom": "17.0.2",
    "react-i18next": "^11.7.3",
    "react-native": "0.68.2",
    "react-native-calendars": "^1.1264.0",
    "react-native-dropdownalert": "^4.3.0",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-image-crop-picker": "^0.37.2",
    "react-native-iphone-x-helper": "^1.3.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.4",
    "react-native-modal": "^13.0.1",
    "react-native-modal-datetime-picker": "^9.2.3",
    "react-native-modalize": "^2.0.8",
    "react-native-pell-rich-editor": "^1.5.5",
    "react-native-reanimated": "~2.8.0",
    "react-native-render-html": "^6.3.4",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-shadow": "^1.2.2",
    "react-native-svg": "12.3.0",
    "react-native-web": "0.17.7",
    "react-native-webview": "11.18.1",
    "react-query": "^3.3.0",
    "sentry-expo": "^4.2.0",
    "yup": "^0.32.9"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/react": "~17.0.21",
    "@types/react-dom": "~17.0.11",
    "@types/react-native": "~0.67.6",
    "@typescript-eslint/eslint-plugin": "^4.4.1",
    "@typescript-eslint/parser": "^4.4.1",
    "babel-plugin-module-resolver": "^4.0.0",
    "eas-cli": "^0.53.0",
    "eslint": "^7.11.0",
    "eslint-config-universe": "^7.0.1",
    "eslint-plugin-react-native": "^3.10.0",
    "expo-cli": "^5.4.8",
    "firebase-tools": "^10.1.1",
    "prettier": "^2.1.2",
    "typescript": "~4.3.5"
  },

Do you need this? Maybe try uninstalling it.

Also, I see you have expo-cli and eas-cli as devDependencies. I think try removing those too (rather install them globally).

Didn’t have that originally. Just tested to see if it would help.

Removed it and also expo-cli and eas-cli but same issue…

OK, well at least it seems to have improved the situation a bit:

Before removing those dependencies I got this:

% expo doctor
✔ Found all copies of expo-modules-autolinking
Expected package expo-modules-autolinking@~0.8.1
Found invalid:
  expo-modules-autolinking@0.7.1
  expo-modules-autolinking@0.5.5
  (for more info, run: npm why expo-modules-autolinking)
✔ Found all copies of @expo/config-plugins
Expected package @expo/config-plugins@^4.1.0
Found invalid:
  @expo/config-plugins@4.0.18
  (for more info, run: npm why @expo/config-plugins)
✔ Found all copies of @expo/prebuild-config
Expected package @expo/prebuild-config@^4.0.0
Found invalid:
  @expo/prebuild-config@3.1.6
  (for more info, run: npm why @expo/prebuild-config)

Afterwards I get this:

% expo doctor
✔ Found all copies of expo-modules-autolinking
Expected package expo-modules-autolinking@~0.8.1
Found invalid:
  expo-modules-autolinking@0.7.1
  (for more info, run: npm why expo-modules-autolinking)
✔ Found all copies of @expo/config-plugins
  All copies of @expo/config-plugins satisfy ^4.1.0
✔ Found all copies of @expo/prebuild-config
  All copies of @expo/prebuild-config satisfy ^4.0.0

I haven’t yet figured out why there’s an issue with expo-modules-autolinking, but it seems like fixing that might solve your problem.

I tried to run expo doctor (after removing dependencies) in my project but it could not find any issues.

Could be you have a slightly out of date version of expo-cli. Mine’s 5.4.10. But maybe not. It seems expo upgrade and/or expo doctor are still not perfect.

After removing yarn.lock and node_modules and re-running yarn, expo doctor is now happy:

% expo doctor
✔ Found all copies of expo-modules-autolinking
  All copies of expo-modules-autolinking satisfy ~0.8.1
✔ Found all copies of @expo/config-plugins
  All copies of @expo/config-plugins satisfy ^4.1.0
✔ Found all copies of @expo/prebuild-config
  All copies of @expo/prebuild-config satisfy ^4.0.0

🎉 Didn't find any issues with the project!

Unfortunately there’s still a build error. But not the same one you got:

> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/home/expo/workingdir/build/node_modules/react-native-reanimated/android/react-native-reanimated-68-jsc.aar
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Could not determine the dependencies of task ':app:mergeReleaseNativeLibs'.
[stderr] > Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
[stderr]    > Could not find any matches for app.notifee:core:+ as no versions of app.notifee:core are available.
[stderr]      Searched in the following locations:
[stderr]        - http://maven-cache-service.production.svc.cluster.local:8081/artifactory/libs-release/app/notifee/core/maven-metadata.xml
[stderr]        - file:/home/expo/.m2/repository/app/notifee/core/
[stderr]        - file:/home/expo/workingdir/build/node_modules/react-native/android/app/notifee/core/maven-metadata.xml
[stderr]        - file:/home/expo/workingdir/build/node_modules/jsc-android/dist/app/notifee/core/maven-metadata.xml
[stderr]        - https://dl.google.com/dl/android/maven2/app/notifee/core/maven-metadata.xml
[stderr]        - https://repo.maven.apache.org/maven2/app/notifee/core/maven-metadata.xml
[stderr]        - https://www.jitpack.io/app/notifee/core/maven-metadata.xml
[stderr]      Required by:
[stderr]          project :app > project :notifee_react-native
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 3m 16s
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.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
6 actionable tasks: 6 executed
Unable to list file systems to check whether they can be watched. The whole state of the virtual file system has been discarded. Reason: Could not query file systems: could not open mount file (errno 2: No such file or directory)
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.

Mine is 5.4.10 as well.

Finally I managed to fix this. All I had to do was to run npx install-expo-modules@latest command.

1 Like