【问题标题】:ProGuard is not workingProGuard 不工作
【发布时间】:2012-07-31 22:58:54
【问题描述】:

我正在使用最新的 SDK 开发一个 Android APP。我正在为 Api 4 (android 1.6) 开发应用程序。

我的项目有一个 proguard-project.txt 文件(这是最新版本的 Android SDK 的 proguard 配置文件)并且 project.properties 文件取消了 proguard 行的注释,所以 proguard已激活(proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt)

问题是我用proguard编译了apk文件,似乎proguard在文件中没有做任何事情,我反编译了apk并显示了与不使用proguard时相同的代码。我的 proguard-project.txt 也是空的。它只包含 cmets...

这是我自动生成的 proguard-project.txt 文件的内容:

    # To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

我必须在这个文件中添加哪些行来混淆、优化和减小我的 apk 文件的大小? (至少可以混淆代码......)

谢谢

【问题讨论】:

    标签: java android proguard


    【解决方案1】:

    Android SDK 仅在您使用ant release 或通过在 Eclipse 中导出 apk 来创建发布版本时应用 ProGuard。

    【讨论】:

    • 那么配置文件中没有配置也没关系?
    猜你喜欢
    • 2017-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多