【问题标题】:"java.lang.AssertionError: APK bundle must contain the expected embedded asset index.android.bundle" error whe building using expo version 6.0.5\"java.lang.AssertionError: APK bundle must contain the expected embedded asset index.android.bundle\" error when building using expo version 6.0.5
【发布时间】:2023-02-09 22:19:30
【问题描述】:

正如标题所说,我收到此错误:

"java.lang.AssertionError: APK bundle must contain the expected embedded asset index.android.bundle"

使用最新的 expo CLI 版本构建后。当我从谷歌商店下载我的应用程序时,它崩溃了,但它在使用 expo 的本地开发模式下工作正常,所以我不知道发生了什么。

以防万一这是 package.json

{
  "name": "dnd",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-regular-svg-icons": "^6.1.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@fortawesome/react-native-fontawesome": "^0.3.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/checkbox": "^0.5.12",
    "@react-navigation/native": "^6.0.11",
    "@react-navigation/native-stack": "^6.7.0",
    "@rneui/base": "^4.0.0-rc.5",
    "@rneui/themed": "^4.0.0-rc.5",
    "expo": "~46.0.8",
    "expo-checkbox": "~2.2.0",
    "expo-splash-screen": "~0.16.1",
    "expo-status-bar": "~1.4.0",
    "expo-updates": "~0.14.4",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "react-native": "0.69.4",
    "react-native-elements": "^3.4.2",
    "react-native-safe-area-context": "4.3.1",
    "react-native-screens": "~3.15.0",
    "react-native-svg": "12.3.0",
    "react-native-text-size": "^4.0.0-rc.1",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.7"
  },
  "devDependencies": {
    "@babel/core": "^7.18.6",
    "@types/react": "~18.0.0",
    "@types/react-native": "~0.69.1",
    "typescript": "^4.6.3"
  },
  "private": true
}

这是 app.json:

{
  "expo": {
    "name": "Hoja de personaje 3.5e",
    "slug": "Hojadepersonaje35e",
    "version": "1.0.2",
    "owner": "calvix1",
    "orientation": "portrait",
    "icon": "./assets/appIcon.jpg",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true
    },
    "android": {
      "package": "com.calvix1.hojadepersonaje35e",
      "softwareKeyboardLayoutMode":"pan",
      "adaptiveIcon": {
        "foregroundImage": "./assets/appIcon.jpg",
        "backgroundColor": "#FFFFFF"
      },
      "versionCode":3
    },
    "web": {
      "favicon": "./assets/favicon.png"
    }
  }
}

该应用程序是使用 Expo sdk 46 构建的。

【问题讨论】:

    标签: android react-native expo


    【解决方案1】:

    我只是有同样的问题。我最近在一个裸项目上从 Expo SDK 45 升级到 Expo SDK 46。

    我不得不使用 react-native 升级助手 (https://react-native-community.github.io/upgrade-helper/?from=0.68.2&to=0.69.5) 来确定 gradle 和其他一些依赖项的预期版本。

    android/build.gradle我改变了:

            classpath 'com.google.gms:google-services:4.3.3'
            classpath('com.android.tools.build:gradle:7.0.4')
            classpath('com.facebook.react:react-native-gradle-plugin')
            classpath('de.undercouch:gradle-download-task:4.1.2')
    
    

            classpath 'com.google.gms:google-services:4.3.3'
            classpath('com.android.tools.build:gradle:7.1.1')
            classpath('com.facebook.react:react-native-gradle-plugin')
            classpath('de.undercouch:gradle-download-task:5.0.1')
    

    这给了我一些提示:index.android.bundle missing in APK after upgrading to RN 0.68

    【讨论】:

      【解决方案2】:

      我在 Expo SDK 47 上遇到了同样的问题,我解决了将我的 eas-cli 更新到最新版本的问题。

      我使用的是 0.54 版本,我更新到 3.5.2

      我在更新这个时遇到了问题,所以我使用 Yarn 来构建:

      yarn add global eas-cli
      yarn eas build --profile production
      

      并且工作得很好!

      【讨论】:

        猜你喜欢
        • 2022-12-27
        • 2019-01-01
        • 1970-01-01
        • 2022-12-02
        • 2021-10-03
        • 2021-08-11
        • 1970-01-01
        • 2022-12-15
        • 2022-11-15
        相关资源
        最近更新 更多