Gradle failed to build when proguard is activated

◇◆丶佛笑我妖孽 提交于 2019-11-27 12:33:27
Eric Schlenz

I've been battling this issue for the past few hours. Basically the proguard task will halt execution if there are any warnings. You can see the Proguard warnings, and the stacktrace, by adding -d to the build (as in: gradle clean assembleRelease -d). Note that the stacktrace mentions to "Please correct the above warnings first."

In order to just get to a point where the build would get through proguard, I had to add -dontwarn entries for packages it was complaining about to my proguard-project.txt file. Something along the lines of:

-dontwarn org.apache.lang.**

...etc

So put simply... do as the stacktrace instructs you to do. Fix the warnings! :)

BTW, I apologize, as I now recognize that the stacktrace in the original post is not quite the same as the one I encountered. However, I do feel my answer is helpful, as obviously I ended up here trying to search for answers to my issue.

Hmmm, I don't understand why but it seems if I start two times the same task with the same parameters (proguard...) the second one is the good one.

But if the second one the parameters change, the task fail.

Hope it will help someone.

Regards

You can use -ignorewarnings at proguard-project.txt so you don't need to specify each package.

Check that your minifyEnabled in build gradle is set to "false". Because when it will be "true" debugger while generating signed apk will give an error.

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