从android studio创建已签名的apk时出错

问题描述:

生成已签名的apk时,出现504错误并显示以下输出。 请让我知道我做错了什么。从android studio创建已签名的apk时出错

在此先感谢...

Error:Execution failed for task 
':app:transformClassesAndResourcesWithProguardForRelease'. 
Job failed, see logs for details 
Information:BUILD FAILED 
Information:Total time: 1 mins 7.38 secs 
Information:1 error 
Information:1,097 warnings 
Information:See complete output in console 

Proguard的是 -

-keep class com.facebook.** { *;} 
-keepattributes Signature 
-keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule 

添加依赖关系 -

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:25.1.0' 
compile 'com.android.support:support-v4:25.1.0' 
compile 'com.android.support:design:25.1.0' 
testCompile 'junit:junit:4.12' 
compile 'net.sourceforge.jexcelapi:jxl:2.6.12' 
compile 'com.facebook.android:facebook-android-sdk:4.18.0' 
compile 'com.github.bumptech.glide:glide:3.7.0' 
compile 'com.google.android.gms:play-services:9.0.0' 
compile 'com.github.barteksc:android-pdf-viewer:2.4.0' 
provided 'org.androidannotations:androidannotations:4.0.0' 
compile 'org.androidannotations:androidannotations-api:4.0.0' 
} 

apply plugin: 'com.google.gms.google-services' 

这个错误发生在SDK的版本,构建工具和Gradle插件不匹配(就兼容性而言)。解决方案是验证您是否正在使用它们的最新版本。 gradle插件放置在项目的build.gradle文件中。其他版本位于模块的build.gradle文件中。例如,对于SDK 25,您必须使用Build Tools 25.0.2和gradle插件2.2.3版。

更改设置后清理项目。

refer this question

+0

谢谢。我赞同你。但是当我做'minifyEnabled false'时,它会成功建立。可能是缩小错误。 –

+0

是的一些依赖关系不能简单。 – vishal

+0

你可以使用proguard-android.txt文件 – vishal