Android & Proguard?

ⅰ亾dé卋堺 提交于 2019-11-29 10:14:26

问题


I am trying to use progurard with my android applications. The proguardGui accepts an input, and an output, the input requires a jar file. but the APK file for android doesn't contain any jar?

I tried passing the apk file, and also the dex file inside the apx, but proguard doesn't accept them as an input. proguard only accepts jars, ears, wars, zips so how can i use the proguard gui with my android application?


回答1:


I detailed complete instructions on how to do it here: http://www.androidengineer.com/2010/07/optimizing-obfuscating-and-shrinking.html

Basically, you have to first set up an Ant build for your Android project, which is relatively painless. Then, you add in the ProGuard Ant target between the Java compilation step and the DEX step. Remember, ProGuard only works on Java bytecode, and Android uses the Dalvik JVM which uses .dex bytecode, so that's why it happens between those two steps.




回答2:


Actually the Android SDK already integrates ProGuard.

You only need to uncomment the line "proguard.config=....." in the file project.properties (created or updated by Android SDK 17 or higher), in order to enable ProGuard.

Source: ProGuard examples -> a complete Android Application



来源:https://stackoverflow.com/questions/3188059/android-proguard

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