开发者

Android simplexml.jar proguard problem

I just try to parse a simple xml documention by simple-xml-2.6.jar.I put this jar into a folder named lib then add it in libraries .Then i attempt to skip this jar so code in the proguard.cfg just like below:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-libraryjars lib/simple-xml-2.6.jar
-dontwarn javax.xml.stream.events.**
-dontwarn javax.xml.stream.**
-keeppackagenames  com.wang.demo
-keep public class org.simpleframework.** { *; }
-keep public class org.simpleframework.xml.core.** { *; }
-keep public class org.simpleframework.* { *; }
-keep public class org.simpleframework.xml.core.* { *; }
-keep public class org.simpleframework.* 
-keep public class org.simpleframework.xml.core.* 
-keep public class org.simpleframework.** { public protected *; }
-keep public class org.simpleframework.xml.core.** { public protected *; }
-keep public class javax.xml.** { *; }
-keepattributes *Annotation*
-dontskipnonpubliclibraryclasses
-keep public class * extends com.wang.demo.CommonResponse { *; }
-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>;
}
-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 *;
}

I want to cover all the Exceptions but the logcat it shows:

08-25 17:06:56.886: WARN/System.err(8745): java.lang.NoSuchMethodException: m(dm,Element)
08-25 17:06:56.886: WARN/System.err(8745):     at java.lang.Class.getMatchingConstructor(Class.java:643)
08-25 17:06:56.886: WARN/System.err(8745):     at java.lang.Class.getConstructor(Class.java:472)
08-25 17:06:56.886: WARN/System.err(8745):     at org.simpleframework.xml.core.at.a(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.be.a(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.q.b(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.q.a(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.b.a(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.b.<init>(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.av.a(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframew开发者_运维百科ork.xml.core.dn.b(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.ar.h(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.ar.g(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.ed.a(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.az.a(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.Persister.read(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.Persister.read(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.Persister.read(Unknown Source)
08-25 17:06:56.897: WARN/System.err(8745):     at org.simpleframework.xml.core.Persister.read(Unknown Source)
08-25 17:06:56.907: WARN/System.err(8745):     at org.simpleframework.xml.core.Persister.read(Unknown Source)


So anyone help me fix it?


I have the same problem.

I thinks it is because proguard changed the name of Annotation attribute. For example, annotation Attribute was defined as:

public @interface Attribute
{
    public String name() default "";
    public String empty() default "";
}

But after obfuscating, it becomes:

public @interface Attribute
{
    public abstract String a();
    public abstract boolean b();
}

Then, at runtime, the code will fail to get attribute name via reflection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜