【问题标题】:React Native signed apk fails after upgrading the gradle build tool version to 3.2.1将 gradle 构建工具版本升级到 3.2.1 后,React Native 签名 apk 失败
【发布时间】:2018-11-23 12:50:09
【问题描述】:

在 build.gradle 文件中升级以下行后

classpath 'com.android.tools.build:gradle:3.2.1'

gradle-wrapper.properties 文件中的以下行

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

我的应用程序的签名发布 apk 根本不工作。虽然当我在开发模式下运行应用程序时一切正常。

以下是我在 android studio logcat 中遇到的错误 -

2018-11-23 17:49:24.552 3506-3570/? E/AndroidRuntime:致命异常: 线程 2 进程:com.simplydatanow.driverapp,PID:3506 java.lang.RuntimeException:无法从资产“index.android.bundle”加载脚本。确保您的捆绑包包装正确或 你正在运行一个打包服务器。 在 com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(本机 方法) 在 com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:216) 在 com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33) 在 com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:234) 在 com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1137) 在 com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:113) 在 com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:944) 在 java.lang.Thread.run(Thread.java:764)

这是已签名的发布 apk,因此 index.android.bundle 应该已经存在于 apk 中。但不知何故,它无法找到它。任何帮助表示赞赏。

package.json 中的所有依赖项 -

"dependencies": {
"moment": "^2.22.2",
"polished": "^1.9.2",
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-auth0": "^1.2.2",
"react-native-background-fetch": "^2.4.3",
"react-native-background-task": "^0.2.1",
"react-native-compress-image": "^2.0.1",
"react-native-datepicker": "^1.7.2",
"react-native-document-picker": "^2.1.0",
"react-native-elements": "^0.19.0",
"react-native-fab": "^1.0.8",
"react-native-fetch-blob": "^0.10.8",
"react-native-floating-action": "^1.13.0",
"react-native-fs": "^2.10.14",
"react-native-image-cache-hoc": "^2.0.0",
"react-native-image-picker": "^0.26.10",
"react-native-image-progress": "^1.1.0",
"react-native-image-to-pdf": "^1.0.0",
"react-native-image-zoom-viewer": "^2.2.24",
"react-native-keyboard-aware-scroll-view": "^0.5.0",
"react-native-keyboard-aware-view": "^0.0.14",
"react-native-pdf": "^5.0.9",
"react-native-progress": "^3.4.0",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-simple-dialogs": "^0.4.1",
"react-native-star-rating": "^1.0.8",
"react-native-timer-component": "^1.0.2",
"react-native-uuid-generator": "^4.0.1",
"react-native-vector-icons": "^4.6.0",
"react-navigation": "^2.14.2",
"react-redux": "^5.0.7",
"redux": "^3.7.2"

},

【问题讨论】:

    标签: android react-native build.gradle


    【解决方案1】:

    在 build.gradle(Module:app) 中更改版本代码和版本名称

    转到 Build-->Generate Signed Bundle or Apk--> 选择 APK--> 点击“Next”--> 输入密钥库凭据,或者如果您没有创建它--> 检查 V1 和 V2在签名版本中--> 点击完成生成签名的 APK。

    将此 APK 上传到 Playstore

    【讨论】:

      猜你喜欢
      • 2018-01-19
      • 2018-12-30
      • 2018-10-10
      • 1970-01-01
      • 1970-01-01
      • 2019-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多