expo: expo-updates: Android app crashes due to app.manifest not existing (SDK 46)
Summary
An android app built by EAS Build (Managed) crashes on loading app.manifest in expo-update.
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: Could not read embedded manifest
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: java.io.FileNotFoundException: app.manifest
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.content.res.AssetManager.nativeOpenAsset(Native Method)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.content.res.AssetManager.open(AssetManager.java:904)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.content.res.AssetManager.open(AssetManager.java:881)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at expo.modules.updates.manifest.EmbeddedManifest.get(EmbeddedManifest.kt:22)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at expo.modules.updates.loader.LoaderTask.launchFallbackUpdateFromDisk(LoaderTask.kt:238)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at expo.modules.updates.loader.LoaderTask.start(LoaderTask.kt:99)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at expo.modules.updates.UpdatesController.start(UpdatesController.kt:290)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at expo.modules.updates.UpdatesController$Companion.initialize(UpdatesController.kt:464)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at expo.modules.updates.UpdatesPackage$createReactNativeHostHandlers$handler$1.onWillCreateReactInstanceManager(UpdatesPackage.kt:41)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:27)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at com.example.MainApplication.onCreate(MainApplication.java:66)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6785)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.os.Handler.dispatchMessage(Handler.java:106)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.os.Looper.loopOnce(Looper.java:201)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.os.Looper.loop(Looper.java:288)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at android.app.ActivityThread.main(ActivityThread.java:7898)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at java.lang.reflect.Method.invoke(Native Method)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
10-26 11:21:14.739 13422 13422 E EmbeddedManifest: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
10-26 11:21:14.739 13422 13422 D AndroidRuntime: Shutting down VM
10-26 11:21:14.739 13422 13422 E AndroidRuntime: FATAL EXCEPTION: main
10-26 11:21:14.739 13422 13422 E AndroidRuntime: Process: com.example, PID: 13422
10-26 11:21:14.739 13422 13422 E 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. app.manifest
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at expo.modules.updates.manifest.EmbeddedManifest.get(EmbeddedManifest.kt:31)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at expo.modules.updates.loader.LoaderTask.launchFallbackUpdateFromDisk(LoaderTask.kt:238)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at expo.modules.updates.loader.LoaderTask.start(LoaderTask.kt:99)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at expo.modules.updates.UpdatesController.start(UpdatesController.kt:290)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at expo.modules.updates.UpdatesController$Companion.initialize(UpdatesController.kt:464)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at expo.modules.updates.UpdatesPackage$createReactNativeHostHandlers$handler$1.onWillCreateReactInstanceManager(UpdatesPackage.kt:41)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:27)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at com.example.MainApplication.onCreate(MainApplication.java:66)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6785)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7898)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
10-26 11:21:14.739 13422 13422 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
10-26 11:21:14.741 1959 13443 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
10-26 11:21:14.741 1959 11526 W ActivityTaskManager: Force finishing activity com.example/.MainActivity
10-26 11:21:14.754 1959 2112 I ActivityManager: Showing crash dialog for package com.example u0
In the apk, assets/app.manifest file doesn’t exist actually. However, when I built again, app.manifest was included and did not crash.
I have encountered this problem several times in the past too, but after rebuilding, it no longer occurs.
What platform(s) does this occur on?
Android
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 12.6
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
Yarn: 1.22.19 - ~/projects/mobile-app/packages/app/node_modules/.bin/yarn
npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/gaishimo/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK:
API Levels: 26, 27, 28, 29, 30, 31, 33
Build Tools: 26.0.3, 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0
System Images: android-22 | Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom_64, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs ARM 64 v8a, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: 24.0.8215888
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
npmGlobalPackages:
eas-cli: 2.5.1
expo-cli: 6.0.5
Expo Workflow: managed
Minimal reproducible example
This is part of eas.json. I set the channel field.
{
"build": {
"preview": {
"channel": "preview",
"distribution": "internal"
}
}
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 16 (7 by maintainers)
Commits related to this issue
- [updates] yet another fix for missing app.manifest on android (#19809) # Why follow up with the findings from https://github.com/expo/expo/issues/19693#issuecomment-1300109166 to have another fix ... — committed to expo/expo by Kudo 2 years ago
- [updates] yet another fix for missing app.manifest on android (#19809) follow up with the findings from https://github.com/expo/expo/issues/19693#issuecomment-1300109166 to have another fix for missi... — committed to expo/expo by Kudo 2 years ago
after figuring out what’s the
compressReleaseAssetstask for, the solution makes sense to me. still wondering whycopyReleaseBundledJscould be beforecompressReleaseAssetswithout specifying dependencies; maybe just a coincidence.i’ll create a pr and follow up with the fix. thanks @baochungit
just add this line in
android/app/build.graldeapply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"Good news!
After many tries with
patch-packageand EAS build tests, I’ve finally found the cause. ThecopyReleaseBundledJsandcopyReleaseExpoManifestmust run before the taskcompressReleaseAssetsso that the compression can collect all necessary files.Here is the list of files in
compressed_assetsfolder that doesn’t lead to the missing app.manifest issue:/home/expo/workingdir/build/android/app/build/intermediates/compressed_assets/release/out/assets/expo-root.pem.jar /home/expo/workingdir/build/android/app/build/intermediates/compressed_assets/release/out/assets/index.android.bundle.jar /home/expo/workingdir/build/android/app/build/intermediates/compressed_assets/release/out/assets/app.manifest.jar /home/expo/workingdir/build/android/app/build/intermediates/compressed_assets/release/out/assets/app.config.jarAnd here will lead to the missing app.manifest issue:
/home/expo/workingdir/build/android/app/build/intermediates/compressed_assets/release/out/assets/expo-root.pem.jar /home/expo/workingdir/build/android/app/build/intermediates/compressed_assets/release/out/assets/index.android.bundle.jar /home/expo/workingdir/build/android/app/build/intermediates/compressed_assets/release/out/assets/app.config.jar