I encountered this problem on simple app build with eas.
It works perfectly when running from expo start
but crashes when build as apk and installed on android.
The error that is logged by the app is:
com.facebook.react.common.JavascriptException: Error: Requiring unknown module "undefined"., js engine: hermes, stack:
unknownModuleError@1:36453
loadModuleImplementation@1:36262
guardedLoadModule@1:35860
metroRequire@1:35531
?anon_0_@1:1397940
asyncGeneratorStep@1:507933
_next@1:508205
anonymous@1:508157
tryCallTwo@61:8
doResolve@216:24
Promise@82:13
anonymous@1:508078
_getDataFromDB@1:1397896
getDataFromDB@1:1397844
?anon_0_@1:1398217
asyncGeneratorStep@1:507933
_next@1:508205
tryCallOne@53:15
anonymous@139:26
anonymous@1:195409
_callTimer@1:194406
_callReactNativeMicrotasksPass@1:194570
callReactNativeMicrotasks@1:196484
__callReactNativeMicrotasks@1:62331
anonymous@1:61473
__guard@1:62208
flushedQueue@1:61384
invokeCallbackAndReturnFlushedQueue@1:61327
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:72)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.jni.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:914)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:224)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:919)
Package.json
{
"name": "app-name",
"version": "1.0.0",
"author": "njbsyd",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "~48.0.18",
"expo-status-bar": "~1.4.4",
"react": "18.2.0",
"react-native": "0.71.8",
"@expo/vector-icons": "^13.0.0",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-navigation/material-bottom-tabs": "^6.2.15",
"@react-navigation/native": "^6.1.6",
"@react-navigation/stack": "^6.3.16",
"axios": "^1.4.0",
"expo-sqlite": "~11.1.1",
"lottie-ios": "^3.4.0",
"lottie-react-native": "5.1.4",
"react-native-action-button": "^2.8.5",
"react-native-autocomplete-input": "^5.3.2",
"react-native-element-dropdown": "^2.9.0",
"react-native-gesture-handler": "~2.9.0",
"react-native-paper": "^5.8.0",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
"react-native-vector-icons": "^9.2.0"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}
eas.json
{
"cli": {
"version": ">= 3.13.3"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
}
}
I build with eas build -p android --profile production
command.
Please! Help.
The app build is expected to load and on the splash screen I added some Fetching functions and after it is loaded the app proceeds to next screen. But it crashes unexpectedly.