I recently updated to expo SDK 44 and now I’m getting below error when trying to build for android using eas-cli.

EAS build using eas build -p android fails due to a gradle error and it seems to be related to @react-native-async-storage/async-storage and com.facebook.react.module.annotations. Building using expo build works fine though. Any ideas?

Related issue in github

Related issue in stackoverflow

My Environment
“expo”: “44.0.0”
@react-native-async-storage/async-storage”: “1.16.1”,

Task :react-native-async-storage_async-storage:compileReleaseJavaWithJavac
[stderr] /home/expo/workingdir/build/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:27: error: package com.facebook.react.module.annotations does not exist
[stderr] import com.facebook.react.module.annotations.ReactModule;
[stderr] ^
[stderr] /home/expo/workingdir/build/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java:35: error: cannot find symbol
[stderr] @ReactModule(name = AsyncStorageModule.NAME)
[stderr] ^
[stderr] symbol: class ReactModule
[stderr] Note: /home/expo/workingdir/build/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
[stderr] Note: Recompile with -Xlint:deprecation for details.
[stderr] Note: /home/expo/workingdir/build/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java uses unchecked or unsafe operations.
[stderr] Note: Recompile with -Xlint:unchecked for details.
[stderr] 2 errors
Task :react-native-async-storage_async-storage:compileReleaseJavaWithJavac FAILED
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ‘:react-native-async-storage_async-storage:compileReleaseJavaWithJavac’.
[stderr] > Compilation failed; see the compiler error output for details.
[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 4m 41s
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 Command-Line Interface
232 actionable tasks: 232 executed
Error: Gradle build failed with unknown error. Please see logs for the “Run gradlew” phase.

Hi @haravanapps

I think your @react-native-async-storage/async-storage is too new.

What does expo doctor give you? I suspect you’ll get something like the following:

% expo doctor
Some dependencies are incompatible with the installed expo package version:
 - @react-native-async-storage/async-storage - expected version: ~1.15.0 - actual version installed: 1.16.1
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo doctor --fix-dependencies,
or install individual packages by running expo install [package-name ...]

Hi @wodin
Thank for support
i try expo install and downgrade version “@react-native-async-storage/async-storage”: “~1.15.0”,
and run expo doctor, say : :tada: Didn’t find any issues with the project!
but not working,
any solution for me ?

Please post the dependencies section of your package.json

hi @wodin
thank for quick response
here is my package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@geuntabuwono/react-native-material-buttons": "~0.7.0",
    "@react-native-async-storage/async-storage": "~1.15.0",
    "@react-native-community/cli-debugger-ui": "~5.0.1",
    "@react-native-community/datetimepicker": "4.0.0",
    "@react-native-community/netinfo": "7.1.3",
    "@react-native-masked-view/masked-view": "0.2.6",
    "@react-native-picker/picker": "2.2.1",
    "@react-navigation/bottom-tabs": "5.11.11",
    "@react-navigation/drawer": "^5.12.5",
    "@react-navigation/native": "5.9.4",
    "@react-navigation/stack": "5.14.5",
    "@reduxjs/toolkit": "^1.6.1",
    "babel-plugin-module-resolver": "~4.1.0",
    "buffer": "^6.0.3",
    "expo": "^44.0.0",
    "expo-app-loading": "~1.3.0",
    "expo-apple-authentication": "~4.1.0",
    "expo-application": "~4.0.1",
    "expo-asset": "~8.4.6",
    "expo-camera": "~12.1.2",
    "expo-clipboard": "~2.1.0",
    "expo-constants": "~13.0.1",
    "expo-device": "~4.1.0",
    "expo-facebook": "~12.1.0",
    "expo-firebase-analytics": "~6.0.0",
    "expo-font": "~10.0.4",
    "expo-google-app-auth": "~8.3.0",
    "expo-haptics": "~11.1.0",
    "expo-image-manipulator": "~10.2.0",
    "expo-image-picker": "~12.0.1",
    "expo-intent-launcher": "~10.1.0",
    "expo-linear-gradient": "~11.0.3",
    "expo-linking": "~3.0.0",
    "expo-location": "~14.0.1",
    "expo-network": "~4.1.0",
    "expo-notifications": "~0.14.0",
    "expo-splash-screen": "~0.14.1",
    "expo-status-bar": "~1.2.0",
    "expo-updates": "~0.11.6",
    "i18next": "~21.0.0",
    "jwt-decode": "^3.1.2",
    "lodash": "^4.17.21",
    "md5": "^2.3.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-error-boundary": "^3.1.3",
    "react-i18next": "~11.15.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-44.0.0.tar.gz",
    "react-native-animatable": "^1.3.3",
    "react-native-countdown-component": "^2.7.1",
    "react-native-custom-scroll-indicator": "^1.0.7",
    "react-native-flash-message": "^0.2.0",
    "react-native-gesture-handler": "~2.1.0",
    "react-native-html-parser": "^0.1.0",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-mask-text": "^0.6.0",
    "react-native-modal": "~13.0.0",
    "react-native-paper": "~4.10.1",
    "react-native-reanimated": "~2.3.1",
    "react-native-render-html": "^6.1.0",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.10.1",
    "react-native-shimmer-placeholder": "^2.0.8",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-star-rating": "^1.1.0",
    "react-native-svg": "12.1.1",
    "react-native-swiper": "~1.6.0",
    "react-native-web": "0.17.1",
    "react-native-webview": "11.15.0",
    "react-navigation-shared-element": "^3.1.3",
    "react-redux": "^7.2.5",
    "rn-placeholder": "^1.3.3",
    "sentry-expo": "^4.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

I created a new blank app and added your dependencies. I can confirm that expo doctor is happy.
I do notice that you have the following:

whereas a newly created Expo SDK 44 app uses:

"react-native": "0.64.3",

I think those should be basically the same, but maybe switch to the official 0.64.3 instead of Expo’s version of React Native. I can’t remember where I saw it, but Expo is apparently planning to use the official React Native package going forward instead of a customised version.

But regardless of that, I was able to build the app with your dependencies as-is. So I’m not sure what’s going wrong when you try it.

Can you try creating a new app, installing all of those dependencies and then see if you can build it?

hi @wodin
thank for quick res
i will try, and get back to you.

hi @wodin
i try to use "react-native": "0.64.3",
but get same error
any solution for me, thanks !

Did you try with a newly created app? i.e. just expo init new-app -t blank and then replace the package.json with the one from your real app. Does it build?

hi @wodin
it work correctly with blank project, so weird !

hmm, let me check with my project again.
Thanks for support

hi @wodin
i solve it by change "expo": "^44.0.0" to "expo": "~44.0.0"
thank a lot for support

I’m glad you got it working :slight_smile:

I don’t understand why that change would have fixed it, because as far as I know Expo never releases a version of the expo package where the middle part of the version number is anything other than 0. So ^44.0.0 and ~44.0.0 should be the same, unless I’m missing something.

Maybe there was something wrong with your node_modules which was somehow fixed by you changing the version number and rerunning yarn/npm. If that is what happened then you could probably have fixed it by removing node_modules and reinstalling your dependencies.

Anyway, glad it’s working now :slight_smile:

1 Like

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