Ejected bare application crashes instantly after build

Hello,

I ejected my project into the bare workflow(Expo version: 38) and I can’t get it to run. It builds properly but when the application starts it crashes instantly with the following error(from logcat):

java.lang.RuntimeException: Unable to instantiate application com.testApp.MainApplication: java.lang.ClassNotFoundException: Didn't find class "com.testApp.MainApplication" on path: DexPathList

Full error here: https://paste.ubuntu.com/p/ySjtPMMjSw/

I’ve tried it on both android emulator(Android 10+) and real device(Android 7.1.1) with the same results.

Environment information:

System:
    OS: Windows 10 10.0.19041
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 5.83 GB / 15.88 GB
  Binaries:
    Node: 14.4.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 26, 28, 30
      Build Tools: 28.0.3, 30.0.0
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: Version  4.0.0.0 AI-193.6911.18.40.6626763
    Visual Studio: Not Found
  Languages:
    Java: 1.8.0_262 - C:\Program Files\OpenJDK\openjdk-8u262-b10\bin\javac.EXE
    Python: 2.7.18 - C:\Python27\python.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: ~16.11.0 => 16.11.0
    react-native: ~0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

Apparently I can post a maximum of 2 links so here is a link with links:

AndroidManifest.xml, build.gradle, MainApplication.java, android folder structure, app.json, package.json: https://paste.ubuntu.com/p/k4D8BmzNCR/

I’ve spent hours on this and I have no luck. Any help would be greatly appreciated I’m at my wits’ end.

Thank you!

edit few hours later

I figured error might be due to camelcase in package name so I the redid whole process with name com.testapp and now im getting following error:

2020-08-17 16:27:11.625 15783-15783/com.testapp E/EmbeddedLoader: Could not read embedded manifest
    java.io.FileNotFoundException: app.manifest
        at android.content.res.AssetManager.nativeOpenAsset(Native Method)
        at android.content.res.AssetManager.open(AssetManager.java:874)
        at android.content.res.AssetManager.open(AssetManager.java:851)
        at expo.modules.updates.loader.EmbeddedLoader.readEmbeddedManifest(EmbeddedLoader.java:73)
        at expo.modules.updates.UpdatesController.start(UpdatesController.java:285)
        at expo.modules.updates.UpdatesController.initialize(UpdatesController.java:96)
        at com.testapp.MainApplication.onCreate(MainApplication.java:84)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6607)
        at android.app.ActivityThread.access$1300(ActivityThread.java:233)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7523)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
2020-08-17 16:27:11.629 15783-15783/com.testapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.testapp, PID: 15783
    java.lang.AssertionError: The embedded manifest is invalid or could not be read. Make sure you have configured expo-updates correctly in android/app/build.gradle. app.manifest
        at expo.modules.updates.loader.EmbeddedLoader.readEmbeddedManifest(EmbeddedLoader.java:78)
        at expo.modules.updates.UpdatesController.start(UpdatesController.java:285)
        at expo.modules.updates.UpdatesController.initialize(UpdatesController.java:96)
        at com.testapp.MainApplication.onCreate(MainApplication.java:84)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6607)
        at android.app.ActivityThread.access$1300(ActivityThread.java:233)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7523)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)

I tried cleaning the project, renaming the unejected expo project then ejecting again, and it’s still the same.

I solved it.
Problem was that the package name was in camelCase com.testApp. Updating to gradle-6.6 in gradle-wrapper.properties and removing import com.facebook.react.BuildConfig; in MainApplication.java made is build successfully.

1 Like