【问题标题】:React Native Release Signed APK crash on app startReact Native Release Signed APK 在应用启动时崩溃
【发布时间】:2019-05-26 04:32:58
【问题描述】:

我对 react native 发行版 APK 有疑问。

应用在调试模式下运行,但在发布模式下立即崩溃

它将安装一些电话,但是当我运行它时,它会立即崩溃,而其他一些电话则不会安装这是我的应用程序,就像这样...

这是我的包依赖列表

"dependencies": {
    "axios": "^0.18.0",
    "jwt-decode": "^2.2.0",
    "native-base": "^2.12.1",
    "react": "16.8.3",
    "react-native": "0.59.8",
    "react-native-awesome-alerts": "^1.2.0",
    "react-native-elements": "^1.1.0",
    "react-native-gesture-handler": "^1.2.1",
    "react-native-maps": "^0.24.2",
    "react-native-otp-inputs": "^3.0.2",
    "react-native-swiper": "^1.5.14",
    "react-native-vector-icons": "^6.4.2",
    "react-navigation": "^3.9.2",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0"
},

而我的 android/build.gradle 文件是 -

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        multiDexEnabled = true
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
    }
}

我的 android studio log cat crash ....

【问题讨论】:

  • 发布崩溃日志
  • 是的,您可以在 Android Studio 中看到崩溃日志,但是根据我在 React Native 中的经验,您的 .apk 很有可能错过了 js 包。看看这个stackoverflow.com/questions/34175416/…
  • 崩溃日志图片在此处更新,请再次查看@AADProgramming 帖子
  • 请查看我更新帖子@DNA.h的崩溃日志图片
  • 能否包含您的 AndroidManifest.xml 文件?

标签: android react-native android-signing


【解决方案1】:

根据您的崩溃日志,以及应用程序在调试中运行的事实,您很可能遇到了捆绑问题。再次运行此命令以创建新的捆绑包

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

如果你没有 index.android.js,并创建一个新版本

【讨论】:

  • 能否也提供“index.js”或“index.android.js”的内容和“android/app/src/.../MainApplication.java”的内容
  • 这个链接我提供了两个文件..drive.google.com/open?id=12s3tp1oSwW4N9-golbhhMhVkLQRAIDXk
  • 你可以看到这个文件@DNA.h
  • 您的崩溃日志显示未找到通知。在您的包裹列表中,我看不到与通知相关的包裹。所以我假设您在某处缺少“react-native 链接”或“/android/gradlew clean”。如果您也可以附加 package.json 肯定会有帮助
  • 我会找到我的问题并解决它,也感谢找到我的错误@DNA.h
【解决方案2】:

我有同样的错误,将 react-native 更改为 0.59.3

运行

纱线添加 react-native@0.59.3

npm i --save react-native@0.59.3

我还删除了 android/app/buildnode_modules/(为了重新构建)

显然这是与 0.59.8 版本相关的错误

【讨论】:

    猜你喜欢
    • 2021-04-05
    • 2019-07-05
    • 2023-03-18
    • 1970-01-01
    • 2020-01-18
    • 1970-01-01
    • 1970-01-01
    • 2022-01-02
    相关资源
    最近更新 更多