can't generate signed APK from Android studio “Execution failed for task ':packageRelease'”

我们两清 提交于 2019-11-27 13:28:59
Artemiy

Just add to the project's proguard-rules:

-keep public class com.google.android.gms.**
-dontwarn com.google.android.gms.**

It worked after setting followings in 'proguard-project.txt'. Obviously the gradle should be set for this file.

-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

Look at your build output. You might have proguard warnings in there, like if you have 2 libraries that share some class (with potentialy different versions).

This might prevent proguard to compute an hash.

I had the same issue while having both openIAB and opfIAB (both use Amazon and google IAB) in my build. Removing one of these libs resolved my issue

OK! its very easy ! just following step by step: build.gradle :minifyEnabled false -> minifyEnabled true proguard-rules.pro : you have to add third libraries that you use in your project like piccaso and etc. if you do this in android studio , it decline this files.

-dontwarn android.support.**
-dontwarn com.github.**
-dontwarn com.squareup.picasso.**
-dontwarn com.etsy.android.grid.**

it works :)

cherucole

I had the problem too and the best way to solve it is: Go to the gradle console and see where there is a warning e.g

Warning: com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient

Now open the proguard rules file and scroll to the bottom and add the line

-dontwarn com.squareup.okhttp.**

For any missing classes that you find on the gradle console you basically add the line

-dontwarn followed by class name 

Hope this works for everyone too. Good luck!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!