App crashes on launch with manifest error

Hi !

I recently started to work again on a project that was previously on SDK 46.
Following the end of support for this version, I followed the steps on the blog post and updated to SDK 49.

My app was running just as previously using expo start however I now encounter an error when I want to build my app with EAS. Whether it is in APK or AAB format, the app crashes instantly on launch with the following trace:

EmbeddedManifest: Could not read embedded manifest
EmbeddedManifest: java.lang.NullPointerException
EmbeddedManifest:      at expo.modules.updates.manifest.BareUpdateManifest$Companion.fromBareManifest(BareUpdateManifest.kt:97)
EmbeddedManifest:      at expo.modules.updates.manifest.ManifestFactory.getEmbeddedManifest(ManifestFactory.kt:36)
EmbeddedManifest:      at expo.modules.updates.manifest.EmbeddedManifest.get(EmbeddedManifest.kt:30)
EmbeddedManifest:      at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:70)
EmbeddedManifest:      at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:23)
EmbeddedManifest:      at expo.modules.updates.UpdatesController.start(UpdatesController.kt:243)
EmbeddedManifest:      at expo.modules.updates.UpdatesController$Companion.initialize(UpdatesController.kt:603)
EmbeddedManifest:      at expo.modules.updates.UpdatesPackage$createReactNativeHostHandlers$handler$1.onWillCreateReactInstanceManager(UpdatesPackage.kt:56)
EmbeddedManifest:      at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:27)
EmbeddedManifest:      at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
EmbeddedManifest:      at com.dooboo.app.dev.MainApplication.onCreate(MainApplication.java:71)
EmbeddedManifest:      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1202)
EmbeddedManifest:      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7588)
EmbeddedManifest:      at android.app.ActivityThread.access$2600(ActivityThread.java:260)
EmbeddedManifest:      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2435)
EmbeddedManifest:      at android.os.Handler.dispatchMessage(Handler.java:110)
EmbeddedManifest:      at android.os.Looper.loop(Looper.java:219)
EmbeddedManifest:      at android.app.ActivityThread.main(ActivityThread.java:8668)
EmbeddedManifest:      at java.lang.reflect.Method.invoke(Native Method)
EmbeddedManifest:      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
EmbeddedManifest:      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)07-15 11:27:11.637 25728 25728 D AndroidRuntime: Shutting down VM

followed by:

AndroidRuntime: 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. null
AndroidRuntime:        at expo.modules.updates.manifest.EmbeddedManifest.get(EmbeddedManifest.kt:34)
AndroidRuntime:        at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:70)
AndroidRuntime:        at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:23)
AndroidRuntime:        at expo.modules.updates.UpdatesController.start(UpdatesController.kt:243)
AndroidRuntime:        at expo.modules.updates.UpdatesController$Companion.initialize(UpdatesController.kt:603)
AndroidRuntime:        at expo.modules.updates.UpdatesPackage$createReactNativeHostHandlers$handler$1.onWillCreateReactInstanceManager(UpdatesPackage.kt:56)
AndroidRuntime:        at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:27)
AndroidRuntime:        at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
AndroidRuntime:        at com.dooboo.app.dev.MainApplication.onCreate(MainApplication.java:71)
AndroidRuntime:        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1202)
AndroidRuntime:        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7588)
AndroidRuntime:        at android.app.ActivityThread.access$2600(ActivityThread.java:260)
AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2435)
AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:110)
AndroidRuntime:        at android.os.Looper.loop(Looper.java:219)
AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8668)
AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)07-15 11:27:11.639  1633  4448 W ActivityTaskManager:   finishTopCrashedActivityLocked Force finishing activity com.dooboo.app.dev/.MainActivity

I use a Managed workflow but I do have /android and /ios folders in my workspace after running expo prebuild. I haven’t edited anything in these folders.

I tried resolving dependencies with expo upgrade as well as expo-doctor but I still have no idea what is causing the problem. Any clue is welcome!

Please let me know if you need more details.

Update
It seems that I actually am in Bare workflow. I just don’t ever remember ejecting in the first place.

  expo-env-info 1.0.5 environment info:
    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 18.16.1 - C:\Program Files\nodejs\node.EXE      Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD      npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD    
    IDEs:
      Android Studio: AI-212.5712.43.2112.8815526     
    npmPackages:
      @expo/metro-config: ^0.10.6 => 0.10.6
      @expo/webpack-config: ^18.0.1 => 18.1.1
      expo: ^49.0.0 => 49.0.3
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.3 => 0.72.3
      react-native-web: ~0.19.6 => 0.19.6
    Expo Workflow: bare

Hi @dooboo

You probably ran npx expo run:android at some point. That runs npx expo prebuild in the background, which generates the native Android project in the android directory. This effectively switches you to the bare workflow.

To switch back, you should delete the android directory. (Same for ios).

Try building again after doing that.

Hi @wodin
Thank you for your reply.

I deleted the /android folder and ran npx expo-env-info and indeed it now says that I am back in a managed workflow.
However the issue remains the same and the app crashes instantly on launch.

I also tried creating a fresh project with SDK49 and I have the same issue.

Unfortunately there are many reasons an app could crash in production mode while it works in development mode.

First try running the app in production mode on your development machine:

npx expo start --no-dev --minify

then open it in Expo Go or a development build. The development build would be a better test. This might give you more information about the problem.

Otherwise, check the Debugging runtime issues page.

I was able to get it to work!
There was an issue with expo-updates, and even though I don’t uses it directly, it is still a dependency.
So I tried to use version 0.16.4 but I dont think it was compatible with SDK 49 because it was causing a build error. So I down-graded to SDK 48, still with expo-updates 0.16.4 and it worked.

Hi, I’ve upgraded Expo from 47 to 49. iOS works fine but I am getting the same error in production build of Android. The app crashes with the same error about expo-update.

Same on expo SDK 48 + expo-updates 16.4. Production build crashes on start

Same issue. :warning:

android application crashes after creating production build with eas.

I deleted expo-updates and sentry-expo packages from the code and the problem is fixed. Please give it a try and report the result here. I suspect expo-updates is the cause of the problem.

@ardasnturk I was able to get it to work with expo-updates and sentry-expo.

Make sure sentry-expo is up-to-date and expo-updates is properly configured (even if you don’t use it!)

My packages versions are as follow:

  • expo: ^48.0.18
  • sentry-expo: ^7.0.1
  • expo-updates: ~0.16.4

You can refer to : [SDK 48][expo-updates] Could not read embedded manifest; java.io.FileNotFoundException: app.manifest · Issue #21238 · expo/expo · GitHub

and

2 Likes

@dooboo Thank you. Problem solved. :+1:

1 Like