我想减小APK大小
我关注了这些https://facebook.github.io/react-native/docs/signed-apk-android
并运行./gradlew bundleRelease而不是assembleRelease
但是我出错了
任务':app:transformClassesAndResourcesWithProguardForRelease'的执行失败。 作业失败,
所以我该如何解决,我是Google,但问题仍然存在! 但是如果没有Enable Proguard,它会很好地工作,我得到了(Aab&.Apk)这样的解决方法!
我认为此文件存在问题,但我不知道该如何配置!
proguard-rules.pro
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Package.json
{
"name": "APP_NAME",
"version": "1.12.3",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"@react-native-community/async-storage": "^1.4.2",
"@turf/distance": "^6.0.1",
"@turf/helpers": "^6.1.4",
"@turf/invariant": "^6.1.2",
"@turf/turf": "^5.1.6",
"firebase-admin": "^8.1.0",
"firebase-functions": "^3.0.1",
"lodash": "^4.17.11",
"moment": "^2.24.0",
"react": "16.8.6",
"react-moment": "^0.9.2",
"react-native": "0.59.8",
"react-native-app-intro-slider": "^3.0.0",
"react-native-datepicker": "^1.7.2",
"react-native-fcm": "^16.2.4",
"react-native-firebase": "5.3.1",
"react-native-gesture-handler": "1.2.1",
"react-native-image-picker": "^0.28.0",
"react-native-linear-gradient": "^2.5.4",
"react-native-maps": "^0.24.2",
"react-native-stars": "^1.1.5",
"react-native-svg": "^9.3.3",
"react-native-vector-icons": "^6.4.2",
"react-navigation": "3.11.0"
},
"devDependencies": {
"@babel/parser": "^7.4.4",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.8.0",
"jest": "24.8.0",
"metro-react-native-babel-preset": "0.54.1",
"react-devtools": "^3.6.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
答案 0 :(得分:0)
如果您要启用Proguard(在android / app / build.gradle中minifyEnabled为true),则需要更新proguard规则。
在(android / app / proguard-rules.pro)中 添加以下行:
-keep class io.invertase.firebase.** { *; }
-dontwarn io.invertase.firebase.**
有关更多信息,您可以在第4步之前检查https://rnfirebase.io/docs/v5.x.x/installation/android。