Do you need to specify the -injars and -outjars options in ProGuard for Android builds?

久未见 提交于 2019-12-23 12:33:00

问题


The default android proguard.cfg file doesn't specify any -injars or an -outjars option, and I haven't found any documentation on what -outjars' output should be. On the other hand, the ProGuard site provides an android sample that includes -injars and -outjars. Which one should I follow?


回答1:


I did a bit of searching, and I found a file, $ANDROID_SDK/tools/proguard/examples/android.pro, which states:

#
# This ProGuard configuration file illustrates how to process Android
# applications.
# Usage:
#     java -jar proguard.jar @android.pro
#
# If you're using the Android SDK (version 2.3 or higher), the android tool
# already creates a file like this in your project, called proguard.cfg.
# It should contain the settings of this file, minus the input and output paths
# (-injars, -outjars, -libraryjars, -printmapping, and -printseeds).
# The generated Ant build file automatically sets these paths.

# Specify the input jars, output jars, and library jars.
# Note that ProGuard works with Java bytecode (.class),
# before the dex compiler converts it into Dalvik code (.dex).

Which, I assume, answers my question.




回答2:


No, you shouldn't specify any -injars, -outjars, or -libraryjars options. The plugins for Ant, Eclipse, Grade, or Maven add them for you when you build your project, based on the structure of the project. Your configuration file can be empty, except for any project-specific configuration. See the ProGuard page in the Android documentation.

The example on the ProGuard website is for stand-alone builds.



来源:https://stackoverflow.com/questions/11499288/do-you-need-to-specify-the-injars-and-outjars-options-in-proguard-for-android

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