No app.manifest or app.bundle present

Expo SDK: 37
Expo Update: 0.2.7
Expo CLI: 3.21.5
Bare Workflow

I have an issue where I can build an APK but it crashes immediately. I have dug through every forum, SO, and Github post I can find and nothing is clearing up this problem for me… so here we go.

When running the app either with react-native run android or via Android Studio, it builds fine but crashes on startup. The logcat produces the following error:

2020-06-05 16:21:11.734 16022-16022/io.divipay.divi E/EmbeddedLoader: Could not read embedded manifest
    java.io.FileNotFoundException: app.manifest
        at android.content.res.AssetManager.openAsset(Native Method)
        at android.content.res.AssetManager.open(AssetManager.java:347)
        at android.content.res.AssetManager.open(AssetManager.java:321)
        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 io.divipay.divi.MainApplication.onCreate(MainApplication.java:91)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
2020-06-05 16:21:11.735 16022-16022/io.divipay.divi D/AndroidRuntime: Shutting down VM
2020-06-05 16:21:11.735 16022-16022/io.divipay.divi E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.divipay.divi, PID: 16022
    java.lang.AssertionError: The embedded manifest is invalid or could not be read. Make sure you have created app.manifest and app.bundle files and added them to the `assets` folder. If you are using Expo CLI, make sure you have run `expo publish` or `expo export` at least once. More information at https://expo.fyi/embedded-assets
        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 io.divipay.divi.MainApplication.onCreate(MainApplication.java:91)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

I have run expo publish with no errors.

From what I can tell from this article, there should be an app.manifest and an app.bundle file under android/app/src/main but they do not exist. Are these files meant to be auto-generated or are they something I should configure manually? If the latter, can anyone point me in the direction of the intended configuration?

Thanks in advance.

hey! it looks like you’re using expo-updates@0.2.7, the embedded assets article you linked to above applies to older versions. this article explains how it works in 0.2.7: https://blog.expo.io/over-the-air-updates-from-expo-are-now-even-easier-to-use-376e2213fabf

if it’s unclear from reading that what needs to be done, please try creating a new app with expo init and choose bare workflow, then compare the resulting files with your app. also see the expo-updates readme: https://github.com/expo/expo/blob/master/packages/expo-updates/README.md

Everything looks identical. I noticed an error produced by my my IDE’s debugger:

A problem occurred evaluating project ':app'.
Could not read script '/Users/user/myProject/node_modules/expo-updates/scripts/create-manifest-android.gradle' as it does not exist.

It does exist, however.

Screen Shot 2020-06-05 at 5.18.58 PM

try doing a release build in the new project you created for comparison, yarn android --variant Release - if that gives you the same error then you will know something is wrong on a system level vs project level. if it works, then you may be missing some part of the config

Yeah, that test ran without error… let me do some digging.

I have scoured every inch of code and compared everything to the test build you asked me to spin up and can’t find the root cause.

When I run react-native run android I get the error from the OP.

When I run yarn android --variant Release I get an Invariant Violation that application "main" has not been registered.

I went through several troubleshooting steps for that error to no avail. I didn’t change anything about the name configuration in MainApplication.java or MainActivity.java

Either way, the app crashes on startup.

can you share the project with me on github? brentvatne

my guess is that this step wasn’t done:

so i would compare android/app/build.gradle in a new project with your existing one

Unfortunately, that’s not the case. My configuration is correct (followed from the docs).

Sorry, I can’t share the full project due to NDA restrictions. I can share Gists though of specific files.

I got it running!

There was an @Override from some other package in my MainApplication.java that was disallowing some packages from bundling.

This is the code that was present:

return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new StripeReactPackage()
      );

This is the code that should be there:

List<ReactPackage> packages = new PackageList(this).getPackages();
      packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
      return packages;
1 Like

Even though I have this. I am still facing this error. Could anyone help?

@pratikkataria - create a new bare project with expo init and compare the android files with those in your project

Ah I’ve come too far in my current project to compare right. Anyway, a part of the problem got fixed once I ran expo update. I say a part because I don’t have problems with the built apk using expo build:android or even using barcode of expo start. But can’t get npm run android to work directly on my emulated device.

it sounds like… you have a managed project and not a bare project? so i’m not sure why you would see the error mentioned in this thread

I am new to expo terminology. I believe I’ve managed project - never ejected. I was trying to make react-native run-android work which made me encounter this error. I caught the error in Logcat of Android Studio. java.lang.AssertionError: The embedded manifest is invalid or could not be read. Make sure you have created app.manifest and app.bundle files and added them to the assets folder. If you are using Expo CLI, make sure you have run expo publish or expo export at least once.

I’ve ran expo publish after which I was able to figure out about expo build:android that built a working .apk.

https://docs.expo.io/introduction/managed-vs-bare/

you wouldn’t use react-native run-android in a managed project. run expo start —android or yarn android. if you have ios and android directories in your project then it’s a bare project as in we don’t manage the native projects for you. you can remove those if you don’t use them

1 Like

Thanks for making it clear for me. I was unnecessarily going through android project and making changes.