Proguard problems with apk creation

此生再无相见时 提交于 2019-12-06 07:32:15

FWIW, after upgrading to ADT 22 I had over 800 similar errors with a Proguard configuration that was previously working fine, The app also crashed on a device with ClassDefNotFound errors when built without Proguard..

The solution in the end was to tick "Android Private Libraries" on the Order and Export tab of the build path editor for my main project and all of its library projects.

Either you want to use Proguard (optimization, obfuscation, ...) or you don't.

If you dont want, just comment (with a #) the part pointing to your proguard configuration in your project.properties :

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt

If you want to, the solution is to keep the line as it, and create the folowing files : proguard-project.txt and proguard-google-api-client.txt

For the proguard-google-api-client.txt, you can find an exemple here : https://google-api-java-client.googlecode.com/hg/google-api-client-assembly/proguard-google-api-client.txt

For the proguard-project.txt, it will depends on what errors you get after filing the other one. You might need to add several :

-libjars <path_to_a_jar_used_in_app>

and some other -dontwarn, depending on warnings you get ...

Well this feels kinda stupid, for 3 days I messed around with proguard but the problem was that I used the debug keystore SHA1 key in the release apk, hence the Google drive app crash, I used the correct SHA1 key in Google API console to solve it.

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