gpt4 book ai didi

Android Studio Release build 给我 : Unfortunately, “App Name” has stopped

转载 作者:行者123 更新时间:2023-11-29 17:40:52 25 4
gpt4 key购买 nike

我正在使用 Android Studio 1.1.0。构建变体 debug 完美运行,但是当我尝试运行 release 构建变体时,应用程序启动但给我一个“不幸的是,“应用程序名称”已停止。”

我过去已经签署了我的应用程序,也许我错过了一个我完全忘记的简单步骤,我错过了什么?

这是我的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.madx.quiz.apf"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}

signingConfigs {
release {
storeFile file('/Users/madx/Documents/Workspaces/Android/APF/app/keystore.keystore')
storePassword ‘my_store_password’
keyAlias ‘my_key_alias’
keyPassword ‘my_key_password’
}
debug {}
}

buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
debug {
}
}
}

repositories{
// some repositories
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v13:21.0.0'
compile 'com.google.code.gson:gson:2.3.1'
}

事件日志给我:

19:52:49 Gradle build finished in 3 sec
19:52:50 Session 'app': running

日志:

03-02 19:33:11.851  25913-25913/com.madx.quiz.apf I/art﹕ Late-enabling -Xcheck:jni
03-02 19:33:12.840 25913-25946/com.madx.quiz.apf D/OpenGLRenderer﹕ Render dirty regions requested: true
03-02 19:33:12.849 25913-25913/com.madx.quiz.apf D/Atlas﹕ Validating map...
03-02 19:33:12.922 25913-25946/com.madx.quiz.apf I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/24/14, 167c270, I68fa98814b
03-02 19:33:12.924 25913-25946/com.madx.quiz.apf I/OpenGLRenderer﹕ Initialized EGL, version 1.4
03-02 19:33:12.936 25913-25946/com.madx.quiz.apf D/OpenGLRenderer﹕ Enabling debug mode 0

Gradle 控制台:

Executing tasks: [:app:generateReleaseSources]

Configuration on demand is an incubating feature.
:app:preBuild
:app:preReleaseBuild
:app:checkReleaseManifest
:app:preDebugBuild
:app:prepareComAfollestadMaterialDialogs0612Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV132100Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:app:prepareComGithubDanielemaddalunoAndroidupdatecheckerLibrary102Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources
:app:generateReleaseSources

BUILD SUCCESSFUL

Total time: 2.4 secs

最佳答案

尝试在您的发布版本中禁用 ProGuard:

build.gradle :

buildTypes {
release {
signingConfig signingConfigs.release
zipAlignEnabled true
}
debug {
}
}

问题可能是由 ProGuard 引起的,但如果没有堆栈跟踪,我无法真正解决您的问题。

如果你仍然想使用混淆器我建议你查找有关错误的更多信息,你可以在发布字段中添加以下内容:

debuggable true
jniDebuggable true

因此您可以更好地识别问题。然而,问题可能与 gson 库有关,您应该将以下行添加到 proguard-rules.pro 文件(您可以查看更复杂的示例 here ):

# Add any classes the interact with gson
-keepclassmembers class com.madx.quiz.apf.apf.APFQuestion { *; }
-keepclassmembers class com.madx.quiz.apf.apf.APFSubCategory { *; }

###---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }

##---------------End: proguard configuration for Gson ----------

关于Android Studio Release build 给我 : Unfortunately, “App Name” has stopped,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28817257/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com