Android simplexml.jar proguard问题

Android simplexml.jar proguard问题,第1张

概述我只是尝试通过simple-xml-2.6.jar解析一个简单的xml文档.我把这个jar放到一个名为lib的文件夹中,然后将它添加到库中.然后我尝试跳过这个jar,所以在proguard.cfg中的代码如下所示: -optimizationpasses 5-dontusemixedcaseclassnames-dontskipnonpubliclibraryclasses-dontprev 我只是尝试通过simple-xml-2.6.jar解析一个简单的xml文档.我把这个jar放到一个名为lib的文件夹中,然后将它添加到库中.然后我尝试跳过这个jar,所以在proguard.cfg中的代码如下所示:

-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 *;}

我想要涵盖所有异常但它显示的logcat:

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.simpleframework.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?
解决方法 我也有同样的问题.

我认为这是因为proguard更改了Annotation属性的名称.
例如,注释属性定义为:

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

但是在混淆之后,它变成了:

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

然后,在运行时,代码将无法通过反射获取属性名称.

总结

以上是内存溢出为你收集整理的Android simplexml.jar proguard问题全部内容,希望文章能够帮你解决Android simplexml.jar proguard问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1126377.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存