Android Studio发布版本给了我:不幸的是,“;应用程序名称”;停止
我正在开发Android Studio 1.1.0。 构建变量Android Studio发布版本给了我:不幸的是,“;应用程序名称”;停止,android,build,android-studio,release,signing,Android,Build,Android Studio,Release,Signing,我正在开发Android Studio 1.1.0。 构建变量debug工作正常,但当我尝试运行发行版构建变量时,应用程序启动,但给出一个“很遗憾,应用程序名称”已停止 我已经在过去签署了我的应用程序,也许我错过了一个简单的步骤,我完全忘记了,我错过了什么 这是我的build.gradle: apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1
debug
工作正常,但当我尝试运行发行版
构建变量时,应用程序启动,但给出一个“很遗憾,应用程序名称”已停止
我已经在过去签署了我的应用程序,也许我错过了一个简单的步骤,我完全忘记了,我错过了什么
这是我的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
尝试在发布版本中禁用ProGuard:
build.gradle
:
buildTypes {
release {
signingConfig signingConfigs.release
zipAlignEnabled true
}
debug {
}
}
问题可能是由ProGuard引起的,但是如果没有stacktrace,我就无法真正解决您的问题
如果您仍然想使用proguard,我建议您查找有关错误的更多信息,您可以在release字段中添加以下内容:
debuggable true
jniDebuggable true
因此,您可以更好地识别问题。
尽管问题可能与gson库有关,但您应该在proguard rules.pro
文件中添加以下行(您可以查看更复杂的示例):
在没有stacktrace或相关代码的情况下,您希望我们如何帮助您?Android Studio不会返回任何有关停止错误的信息。。。我不知道为什么。我希望其他人也有同样的问题。我如何在问题中添加我的事件日志、Logcat和Gradle控制台输出我试图在发布文件中只保留最小的
signingConfig signingConfigs.release
,但没有任何更改,我已经收到相同的错误您发布的Logcat输出不完整,没有stacktrace我帮不了你。在终端中运行adb logcat,找到堆栈跟踪并发布。好的,我错了,问题是程序错误。。。我必须为Gson库添加一条规则。。。让我用完整的步骤来修改你的答案。如果你接受我的编辑,我会检查你的答案!很高兴看到你的问题解决了:-)很高兴接受我的回答。谢谢你的编辑。
debuggable true
jniDebuggable true
# 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 ----------