【问题标题】:Developer Console Error Reports and using ProGuard's "retrace"开发者控制台错误报告和使用 ProGuard 的“回溯”
【发布时间】:2011-03-24 14:19:18
【问题描述】:

我正在使用默认的 Eclipse 安装来签署和发布应用程序。我没有弄乱 default.properties 文件或 proguard.cfg 文件,但是当我在 Developer Console 上查看堆栈跟踪时,行号仍然关闭。所以看起来我的代码仍然有点模糊。我阅读了 ProGuard 文档,并尝试查找应该在 /proguard 中的 mapping.txt 文件,但在那里或 bin 中没有找到这样的文件夹。

这里发生了什么?有什么办法可以阻止它自动混淆,或者至少让我有一个 mappings.txt 文件?我会很感激任何见解。这是我的 default.properties 文件的内容:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-7

这是我自动生成的 proguard.cfg 文件:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

【问题讨论】:

    标签: android obfuscation deobfuscation


    【解决方案1】:

    在default.properties中,需要一行

    proguard.config=proguard.cfg
    

    启用 Proguard。

    来自ProGuard docs:

    要启用 ProGuard 使其作为 Ant 或 Eclipse 构建的一部分运行,请在 /default.properties 文件中设置 proguard.config 属性。路径可以是绝对路径,也可以是相对于项目根目录的路径。

    【讨论】:

    • 好的,那么将它添加到 default.properties 的最佳方法是什么?我可以忽略该警告并直接编辑它,还是隐藏在 Eclipse 项目属性中的某个地方?谢谢!
    • 只需将“proguard.config=proguard.cfg”行放在“target=android-7”下方(或上方)到 default.properties 中
    猜你喜欢
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2017-11-02
    • 1970-01-01
    • 2016-11-03
    • 1970-01-01
    • 2017-01-01
    • 1970-01-01
    相关资源
    最近更新 更多