expo: Upgraded to SDK 49 and I get 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 on EAS built APK

Minimal reproducible example

https://snack.expo.dev/

Summary

I upgraded to SDK 49 and I get this error in the ADB logs from the Android app built with EAS:

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

This is my app.json:

{
  "expo": {
    "name": "101 Soundboards",
    "slug": "sb-soundboards-all",
    "privacy": "public",
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "version": "110.0.0",
    "orientation": "default",
    "icon": "./assets/icon-android-512.png",
    "splash": {
      "image": "./assets/splash-dark-mode.png",
      "resizeMode": "contain",
      "backgroundColor": "#212529"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "sb.soundboards.all",
      "buildNumber": "110.0.0",
      "backgroundColor": "#212529",
      "icon": "./assets/icon-ios-1024.png",
      "isTabletOnly": false
    },
    "android": {
      "package": "sb.soundboards.all",
      "versionCode": 110,
      "blockedPermissions": [
        "android.permission.WRITE_EXTERNAL_STORAGE"
      ],
      "config": {},
      "intentFilters": [
        {
          "action": "VIEW",
          "data": [
            {
              "scheme": "https",
              "host": "*.101soundboards.com",
              "pathPrefix": "/boards/"
            }
          ],
          "category": [
            "BROWSABLE",
            "DEFAULT"
          ]
        }
      ]
    },
    "androidNavigationBar": {
      "backgroundColor": "#212529"
    },
    "scheme": "sb101",
    "hooks": {
    },
    "extra": {
      "eas": {
        "projectId": "dbac0ffc-934b-4b3d-97d3-972000582278"
      }
    },
    "plugins": [
    ]
  }
}

Environment

expo-env-info 1.0.5 environment info: System: OS: Windows 10 10.0.19045
Binaries: Node: 18.16.0 - C:\Program Files\nodejs\node.EXE npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: AI-222.4459.24.2221.10121639 npmPackages: 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: managed

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 10
  • Comments: 22 (6 by maintainers)

Most upvoted comments

I managed to get it working by:

  1. Updating expo-updates to version 0.18.11 (npx expo install expo-updates) and eas-cli to version 3.17.0 (npm install -g eas-cli).
  2. Running eas update:configure, and copied the missing configuration to the app.json. In my case, it ended like this:
    "updates": {
      "enabled": true,
      "fallbackToCacheTimeout": 0,
      "url": "https://u.expo.dev/[some uuid goes here...]"
    },
    "runtimeVersion": {
      "policy": "sdkVersion"
    },
  1. Running eas build:configure. In my case my eas.json was OK, but check yours.
  2. Adding expo-updates to your plugins in app.json:
   "plugins": [
     "expo-updates"
   ]

@manuelmhtr and @sem4phor solution didn’t work for me, still facing this error.

I resolved this issue, removing expo-updates from dependencies

Can confirm that this was crashing before initialising it with eas update:configure and now it’s working 😃

To disable updates in the time you do not want to use that feature yet (app.json):

"updates": {
    "enabled": false
},

Same error for me, just consumed 5/30 build for this problem!

Looking at https://github.com/expo/sentry-expo/pull/356, the expo-updates dependency was removed in sentry-expo 7.0.1.

We can update the documentation to remove expo-updates as a dependency in the setup.

In a nutshell, if expo-updates is installed it needs to have some configuration. But we removed the need to install expo-updates for sentry-expo. So you should be able to remove expo-updates if you’re not using it.

@azizsaad there’s no need to set the username. According to the documentation, EAS configures it automatically.

The plugin is configured with the Expo account’s username automatically when EAS CLI is used.

Other this I did but didn’t mention because I think they are not related (but may be worth the try) are:

  • Renaming the options releaseChannel to channel in eas.json
  • Running yarn upgrade

Hope it helps!

Hey @wschurman 👋

Thanks for the update! I just ran into this issue in a managed expo project of mine, following an upgrade to Expo SDK 49.

We weren’t actively using the legacy expo-updates module, it had only been added as a dependency due to the sentry-expo setup guide. After removing expo-updates from the package.json, replacing references of Constants.manifest with Constants.expoConfig and also removing any expo-updates config properties from the app.json & eas.json files, I no longer encountered the issue described here. 🎉

The answer of @manuelmhtr is perfect. Thanks

Switching from the classic expo-updates to eas-update fixed this for me in production

Possible workaround

Got the app working by using expo@49.0.6, expo-updates@0.18.11, sentry-expo@7.0.1, and by adding the following to package.json as suggested here:

{ 
  // rest of the contents in package.json 
  
  "expo": {
    "autolinking": {
      "exclude": [
        "expo-updates"
      ]
    }
  }
}

The app has been running in production for about a week and Sentry seems to work as expected.

Recipe for reproducing crash on Android

  1. Create a new managed Expo v49 app
  2. Add Sentry by following the offical instructions (with expo-update as a side dependency)
  3. Do not configure expo-updates
  4. Build a release version with EAS Build
  5. Start release version of app from step 4 on Android and observe it crashes on bootup

For the record here is the stacktrace from Logcat:

2023-07-18 18:55:42.372 12968-12968 EmbeddedManifest        com.example.expocrash202307          E  Could not read embedded manifest

java.lang.NullPointerException
at expo.modules.updates.manifest.BareUpdateManifest$Companion.fromBareManifest(BareUpdateManifest.kt:97)
at expo.modules.updates.manifest.ManifestFactory.getEmbeddedManifest(ManifestFactory.kt:36)
at expo.modules.updates.manifest.EmbeddedManifest.get(EmbeddedManifest.kt:30)
at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:70)
at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:23)
at expo.modules.updates.UpdatesController.start(UpdatesController.kt:243)
at expo.modules.updates.UpdatesController$Companion.initialize(UpdatesController.kt:603)
at expo.modules.updates.UpdatesPackage$createReactNativeHostHandlers$handler$1.onWillCreateReactInstanceManager(UpdatesPackage.kt:56)
at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:27)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
at com.example.expocrash202307.MainApplication.onCreate(MainApplication.java:71)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6759)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

2023-07-18 18:55:42.373 12968-12968 AndroidRuntime          com.example.expocrash202307          D  Shutting down VM
2023-07-18 18:55:42.373 12968-12968 AndroidRuntime          com.example.expocrash202307          E  FATAL EXCEPTION: main

Process: com.example.expocrash202307, PID: 12968
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
at expo.modules.updates.manifest.EmbeddedManifest.get(EmbeddedManifest.kt:34)
at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:70)
at expo.modules.updates.launcher.NoDatabaseLauncher.<init>(NoDatabaseLauncher.kt:23)
at expo.modules.updates.UpdatesController.start(UpdatesController.kt:243)
at expo.modules.updates.UpdatesController$Companion.initialize(UpdatesController.kt:603)
at expo.modules.updates.UpdatesPackage$createReactNativeHostHandlers$handler$1.onWillCreateReactInstanceManager(UpdatesPackage.kt:56)
at expo.modules.ReactNativeHostWrapperBase.createReactInstanceManager(ReactNativeHostWrapperBase.kt:27)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:42)
at com.example.expocrash202307.MainApplication.onCreate(MainApplication.java:71)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6759)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

I removed sentry-expo and expo-updates and the Android build worked.

Possibly related to https://github.com/expo/expo/issues/23382. Suspected cause is unconfigured expo-updates which can happen after setting up sentry-expo which mandates expo-updates as a side dependency. Have an app which where this happens as well. Have so far only been able to reproduce in an app built with EAS Build in release mode (no Expo Go).