开发人员控制台错误报告并使用ProGuard的“回溯”

时间:2011-03-24 14:19:19

标签: android obfuscation deobfuscation

我正在使用默认的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 *;
}

1 个答案:

答案 0 :(得分:0)

在default.properties中,您需要行

proguard.config=proguard.cfg

启用Proguard。

来自ProGuard docs:

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