Proguard和混淆AndroidRuntime错误

时间:2013-06-26 13:08:29

标签: android proguard

我第一次使用Proguard,它很有趣,但时不时会卡住。

使用-dontobfuscate“标签将我的类重命名为”a“,”b“等,这很好。问题是当我在设备上运行Android应用程序时,在加载屏幕后我点击了应该启动AsynkTask的按钮是崩溃,这是我从堆栈跟踪中得到的:

06-26 15:59:23.545: E/AndroidRuntime(26644): Caused by: java.lang.ExceptionInInitializerError
06-26 15:59:23.545: E/AndroidRuntime(26644):    at sn.<init>(SourceFile:210)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at sm.<init>(SourceFile:18)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at tq.b(SourceFile:27)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at tq.a(SourceFile:40)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at sy.a(SourceFile:37)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at tc.a(SourceFile:30)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at rz.a(SourceFile:102)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at sf.e(SourceFile:498)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at sc.a(SourceFile:154)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at rb.a(SourceFile:18)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at ra.a(SourceFile:156)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at ra.doInBackground(SourceFile:1)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-26 15:59:23.545: E/AndroidRuntime(26644):    ... 5 more
06-26 15:59:23.545: E/AndroidRuntime(26644): Caused by: java.lang.ExceptionInInitializerError
06-26 15:59:23.545: E/AndroidRuntime(26644):    at ss.<clinit>(SourceFile:20)
06-26 15:59:23.545: E/AndroidRuntime(26644):    ... 19 more
06-26 15:59:23.545: E/AndroidRuntime(26644): Caused by: java.lang.NullPointerException
06-26 15:59:23.545: E/AndroidRuntime(26644):    at java.util.Properties.load(Properties.java:246)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at sr.d(SourceFile:151)
06-26 15:59:23.545: E/AndroidRuntime(26644):    at sr.<clinit>(SourceFile:135)
06-26 15:59:23.545: E/AndroidRuntime(26644):    ... 20 more
06-26 15:59:23.565: E/android.os.Debug(2293): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
06-26 15:59:23.570: I/dumpstate(26746): begin

我想暗示我做错了什么,因为我确定无疑。 这是我的配置文件:

-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar

-libraryjars C:\adt-bundle\sdk\platforms\
-libraryjars /libs/androidmarketapi-0.6.jar
-libraryjars /libs/google-play-services.jar
-libraryjars /libs/jsoup-1.7.2.jar
-libraryjars /libs/protobuf-java-2.2.0.jar

-optimizationpasses 5
-dontpreverify
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
-keepattributes *Annotation*, EnclosingMethod
-ignorewarnings

-keep public class com.mypackage.MainActivity

## if i choose to obfuscate it crashes.
##-dontobfuscate
##-obfuscationdictionary assets/urls.properties

-printmapping out.map
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

-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.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

# Preserve all native method names and the names of their classes.
-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.content.Context {
   public void *(android.view.View);
   public void *(android.view.MenuItem);
}

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

-keepclassmembers class * implements android.os.Parcelable {
    static android.os.Parcelable$Creator CREATOR;
}

# Preserve static fields of inner classes of R classes that might be accessed
# through introspection.
-keepclassmembers class **.R$* {
    public static <fields>;
}

# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

您是否有过这方面的经验,或者您是否遇到过此运行时错误?谢谢你的时间。

0 个答案:

没有答案