0

我有一个 Jenkins 构建服务器,用于使用 ant 和 Android(SDK 修订版 18)构建 Android APK。发布 APK 工作正常。但是,如果我通过提供 proguard.cfg 并通过 project.properties 中的“proguard.config=proguard.cfg”指向它来启用 proguard,则似乎会发生以下情况:

Proguard 被执行(从 shell 输出和之后的 mappings.txt 和 seed.txt 可以看出)一个 apk 被生成。然而,APK 生成的 Stacktraces 根本没有被混淆。

有人对此有想法吗?似乎proguard生成的jar由于某些原因没有包含在apk中。


这是我的 Proguard 配置

-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 * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

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

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

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

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

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

#ACRA specifics
# we need line numbers in our stack traces otherwise they are pretty useless
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

# ACRA needs "annotations" so add this... 
-keepattributes *Annotation*

# keep this class so that logging will show 'ACRA' and not a obfuscated name like 'a'.
# Note: if you are removing log messages elsewhere in this file then this isn't necessary
-keep class org.acra.ACRA {
        *;
}

# keep this around for some enums that ACRA needs
-keep class org.acra.ReportingInteractionMode {
   *;
}

# keep this otherwise it is removed by ProGuard
-keep public class org.acra.ErrorReporter
{
public void addCustomData(java.lang.String,java.lang.String);
}

# keep this otherwise it is removed by ProGuard
-keep public class org.acra.ErrorReporter
{
public org.acra.ErrorReporter$ReportsSenderWorker handleSilentException(java.lang.Throwable);
}

mappings.txt 声明我的代码被混淆了:

de.cellular.crashtest.ObfuscateThisClass -> de.cellular.crashtest.b:

但是它在报告的 Stacktrace 中没有被混淆

4

1 回答 1

0

似乎这只是一个詹金斯配置问题:apk是从bin/目录中存档的,但混淆的那个在release/

于 2012-06-08T14:20:28.770 回答