在 Eclipse 中使用 Proguard 版本进行 Android 开发时,如何检查/升级 Proguard 版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5013163/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:48:03  来源:igfitidea点击:

How can I check/upgrade Proguard version whn using it in Eclipse for Android development?

androideclipseobfuscationproguard

提问by user496854

The documentation on this is extremely poor. I understand that ProGuard can be enabled by manually editing "default.properties" in the project's rot directory. And all the settings go into the "proguard.cfg" file in the same place, but I'd like to know which version of ProGuard is being used (I'm using Eclise Indigo). I would also like to be able to upgrade it to the latest versions whenever the are released. But I can't find any reference on how to do it.

这方面的文档非常糟糕。我知道可以通过手动编辑项目 rot 目录中的“default.properties”来启用 ProGuard。并且所有设置都在同一位置进入“proguard.cfg”文件,但我想知道正在使用哪个版本的 ProGuard(我使用的是 Eclise Indigo)。我还希望能够在发布时将其升级到最新版本。但我找不到任何关于如何做的参考。

回答by Eric Lafortune

The ProGuard jar is located inside the Android SDK: android-sdk/tools/proguard/lib/proguard.jar

ProGuard jar 位于 Android SDK 内:android-sdk/tools/proguard/lib/proguard.jar

You can print out its version number with

您可以打印出它的版本号

java -jar android-sdk/tools/proguard/lib/proguard.jar

(with the proper path). If necessary, you can replace the jar(actually, the entire proguardsubdirectory) with the latest version from the download pageat the official ProGuard site.

(使用正确的路径)。如有必要,您可以从ProGuard 官方站点的下载页面将 jar(实际上是整个proguard子目录)替换为最新版本。

回答by tos

For the visually inclined, the version of Proguard can also be checked by double clicking on proguardgui.jar in ...\android-sdk\tools\proguard\lib

对于有视觉倾向的人,也可以通过双击...\android-sdk\tools\proguard\lib中的proguardgui.jar来查看Proguard的版本

回答by sschuberth

Quoting my own answer from over here, you can override the ProGuard version like so:

这里引用我自己的答案,您可以像这样覆盖 ProGuard 版本:

buildscript {
    configurations.all {
        resolutionStrategy {
            force 'net.sf.proguard:proguard-gradle:5.3.2'
        }
    }
}