我想使用Proguard主要是出于混淆的原因.
我在Android中遇到了proguard的问题.我使用simpleframework来解析XML;它的外在.
在proguard cfg中:
-keepattributes *Annotation*,EnclosingMethod -keep public class org.simpleframework.**{ *; } -keep public class org.simpleframework.xml.**{ *; } -keep public class org.simpleframework.xml.core.**{ *; } -keep public class org.simpleframework.xml.util.**{ *; } -keep public class org.simpleframework.xml.stream.**{ *; } -keep public class javax.** { *; } -keep public class javax.xml.stream.**{ *; } -keep public class org.simpleframework.** { public void set*(***); public *** get*(); }
错误:
Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLInputFactory Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLEventReader Warning: org.simpleframework.xml.stream.StreamProvider: can't find referenced class javax.xml.stream.XMLEventReader Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.XMLEventReader Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$Entry: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader$Entry: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader$Entry: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader$Entry: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader$Entry: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader$Entry: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.Location Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.StartElement Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.StartElement Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.Location Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.StartElement Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.StartElement Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.Location Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$start: can't find referenced class javax.xml.stream.events.Attribute Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.Characters Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.Characters Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.Characters Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.XMLEvent Warning: org.simpleframework.xml.stream.StreamReader$Text: can't find referenced class javax.xml.stream.events.XMLEvent
我不知道如何解决这个问题. gradle cfg的路径是可以的.
在gradle中:
buildTypes { release { runProguard true proguardFile file('proguard.txt') signingConfig signingConfigs.release } }
解决方法
这个proguard配置帮助我:
Proguard obfuscation is breaking simplexml
# The following line may be different -libraryjars <java.home>/lib/rt.jar(java/**,javax/**) -optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose # (3)Not remove unused code -dontshrink -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 # (2)Simple XML -keep public class org.simpleframework.**{ *; } -keep class org.simpleframework.xml.**{ *; } -keep class org.simpleframework.xml.core.**{ *; } -keep class org.simpleframework.xml.util.**{ *; } # (1)Annotations and signatures -keepattributes *Annotation* -keepattributes Signature -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 *; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。