0

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.

1 Answers1

0

I found the answer to my question. So I will answer it on Stack Overflow to help anyone else who encounters the same problem.

The problem was with an EAS-built Android app that kept crashing as soon as the splash screen loaded. The issue in the code was that some files were missing. This happened because EAS zips the files and uploads them to servers for the build process. However, it only includes files that are part of the commits and skips those specified in the ignore files like .gitignore.

To solve this problem, first run this command:

eas build:inspect --platform android|ios --stage archive --output <Existing Directory>\folder name for_eas_archive --profile <profile name from eas.json>

This command helps you check which files of yours are being included in your build. Replace the placeholders with appropriate information.

Then, open the generated archive and check if any files are missing. In my case, I found my Secret File file missing because I had put it in the .gitignore file to avoid committing it to GitHub.

By following these steps, you can identify which files are being included in your build and ensure that any necessary files are not being omitted due to ignore configurations.

I hope this explanation helps!

  • This answer looks like it was generated by an AI (like ChatGPT), not by an actual human being. You should be aware that [posting AI-generated output is officially **BANNED** on Stack Overflow](https://meta.stackoverflow.com/q/421831). If this answer was indeed generated by an AI, then I strongly suggest you delete it before you get yourself into even bigger trouble: **WE TAKE PLAGIARISM SERIOUSLY HERE.** Please read: [Why posting GPT and ChatGPT generated answers is not currently allowed](https://stackoverflow.com/help/gpt-policy). – tchrist Jul 09 '23 at 15:21
  • Thanks for your concern, but I wrote this response word by word myself. what makes you think this was generated via AI? Da moor pa kwas de football wakam. – Najeeb Said Aug 03 '23 at 00:58