1

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

1 回答 1

0

在 default.properties 中,您需要该行

proguard.config=proguard.cfg

启用 Proguard。

来自ProGuard文档:

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

于 2011-03-24T15:26:33.000 回答