React Native签名的apk在升级gradle构建工具版本到3.2.1后失败



升级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工作室logcat-中得到的错误

2018-11-23 17:49:24.552 3506-3570/?E/AndroidRuntime:致命异常:螺纹-2流程:com.simplydatanow.driverapp,PID:3506java.lang.RuntimeException:无法从资产"index.android.bundle"加载脚本。请确保您的捆绑包打包正确或您正在运行一个打包服务器。网址:com.facebook.areact.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native方法(网址:com.facebook.areact.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:216(网址:com.facebook.reflect.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33(网址:com.facebook.areact.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:234(网址:com.facebook.areact.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1137(网址:com.facebook.areact.ReactInstanceManager.access$900(ReactInstanceManager.java:113(网址:com.facebook.areact.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"

},

在build.gradle(模块:应用程序(中更改版本代码和版本名称

转到构建-->生成签名捆绑包或Apk-->选择Apk-->单击"下一步"-->输入密钥库凭据,或者如果您没有创建它-->检查签名版本中的V1和V2-->单击"完成"生成签名Apk。

将此APK上传到playstore

最新更新