我是第一次使用 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();
}
你有这方面的经验还是你遇到过这个运行时错误?感谢您的时间。