I am having some issues when migrating to Gradle 7 and I got a few errors at the runtime. My build is getting successful but cannot be redirected to the ”Login Screen”. As such, the issue is basically raised from the NPM package that creates an issue while migrating.
Java Version:
JDK Version: 11
Android Versions:
Gradle Version: 7.2
Gradle Plugin Version: 4.2.2
buildToolsVersion = '30.0.2'
supportLibVersion = '30.0.2'
minSdkVersion = 26
compileSdkVersion = 31
targetSdkVersion = 30
kotlin_version = '1.6.0'
React Native Versions:
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.68.0",
"react-native-flipper": "^0.153.0",
"react-native-reanimated": "^1.13.4",
"expo": "^44.0.0",
Root cause of the issue:
- I am using some npm libraries that are deprecated, For e.g. I am using
unimodules
that are now deprecated and of no use, so instead I usedexpo
modules, and currently the expo version44.0.0
. - Below are URLs from which I migrated
react-native-unimodules
toexpo
, these are the URLs helpful to migrate to theexpo
modules. - The
expo
modules create some issues at the runtime and throw the error mentioned in the screenshot at the bottom.
Error message:
ERROR TypeError: (0, _expoModulesCore.requireNativeModule) is not a function. (In '(0, _expoModulesCore.requireNativeModule)('ExpoCrypto')', '(0, _expoModulesCore.requireNativeModule)' is undefined) LOG Running "TestApp" with {"rootTag":1} ERROR Invariant Violation: "TestApp" has not been registered. This can happen if:
- Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
- A module failed to load due to an error and
AppRegistry.registerComponent
wasn't called.
Note:
- I have gone through many documents and URLs for a better understanding and applied a few steps as per the requirements.
- But there are no specific steps that are given anywhere to migrate to Gradle 7, not even in the React Native or Facebook community’s forum page.
Screenshot: