【问题标题】:Do you need to specify the -injars and -outjars options in ProGuard for Android builds?您是否需要在 ProGuard for Android 构建中指定 -injars 和 -outjars 选项?
【发布时间】:2012-07-16 06:44:16
【问题描述】:

默认的 android proguard.cfg 文件没有指定任何 -injars-outjars 选项,我还没有找到任何关于 -outjars' 输出应该是什么的文档。另一方面,ProGuard 站点提供了一个包含-injars-outjars 的android 示例。我应该关注哪一个?

【问题讨论】:

    标签: android proguard


    【解决方案1】:

    我搜索了一下,找到了一个文件,$ANDROID_SDK/tools/proguard/examples/android.pro,上面写着:

    #
    # 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).
    

    我认为这回答了我的问题。

    【讨论】:

    • 那么您最终是指定了 injarsoutjars,还是只是在 IDE 中使用了 Proguard 插件?
    【解决方案2】:

    不,您不应指定任何 -injars、-outjars 或 -libraryjars 选项。 Ant、Eclipse、Grade 或 Maven 的插件会在您构建项目时根据项目的结构为您添加它们。您的配置文件可以为空,但任何特定于项目的配置除外。请参阅 Android 文档中的 ProGuard 页面。

    ProGuard 网站上的示例用于独立构建。

    【讨论】:

      猜你喜欢
      • 2012-06-03
      • 2010-09-27
      • 1970-01-01
      • 1970-01-01
      • 2011-07-13
      • 2013-08-29
      • 2021-05-14
      • 1970-01-01
      相关资源
      最近更新 更多