[英]Apk crashes when Release mode but in debug mode works perfectly
我有發布模式的 apk,但是應用程序崩潰。但是帶有調試 apk 的 apk 沒有崩潰這是我的 android/app/build.gradle
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
} }
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
} }
我的 react-native 版本是“react-native”:“^0.62.2”,並且
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
通常這與 proguard 混淆有關,您可以檢查是否注釋掉以下行:
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
如果這有幫助 - 你需要以某種方式調整 proguard-rules.pro 避免重命名某些類。
要使用adb logcat
命令查找導致崩潰調試的確切原因(或者只需查看 Android Studio 中的“運行”window)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.