我们在使用SimpleXml和Proguards模糊处理(现在只发现一个)特定设备时遇到问题。它是联想P90。
在其他所有设备上,应用程序到目前为止都运行良好。此外,当我关闭混淆时,app工作正常。
从设备记录:
W/dalvikvm: VFY: unable to resolve static method 873: Ljavax/xml/stream/XMLInputFactory;.newInstance ()Ljavax/xml/stream/XMLInputFactory;
D/dalvikvm: VFY: replacing opcode 0x71 at 0x0003
W/dalvikvm: VFY: unable to find class referenced in signature (Ljavax/xml/stream/XMLEventReader;)
W/dalvikvm: VFY: unable to find class referenced in signature (Ljavax/xml/stream/XMLEventReader;)
I/dalvikvm: Could not find method javax.xml.stream.XMLInputFactory.createXMLEventReader, referenced from method org.simpleframework.xml.stream.StreamProvider.provide
W/dalvikvm: VFY: unable to resolve virtual method 871: Ljavax/xml/stream/XMLInputFactory;.createXMLEventReader (Ljava/io/InputStream;)Ljavax/xml/stream/XMLEventReader;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method javax.xml.stream.XMLInputFactory.createXMLEventReader, referenced from method org.simpleframework.xml.stream.StreamProvider.provide
W/dalvikvm: VFY: unable to resolve virtual method 872: Ljavax/xml/stream/XMLInputFactory;.createXMLEventReader (Ljava/io/Reader;)Ljavax/xml/stream/XMLEventReader;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
W/dalvikvm: WARNING: could not find annotation member b in Lorg/simpleframework/xml/ElementList;
E/dalvikvm: Failed creating annotation element (m=0x4f29bc50 n=0x4f29bc30 a=0x0 r=0x0)
E/KBMB:SimpleRestJob2: java.lang.RuntimeException: failure in processEncodedAnnotation
retrofit.RetrofitError: java.lang.RuntimeException: failure in processEncodedAnnotation
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at $Proxy18.a(Native Method)
at cz.kb.mba.core.contacts.dataaccess.ContactsProcessorImpl.a(ContactsProcessorImpl.java:41)
at cz.kb.mba.core.contacts.dataaccess.ContactsProcessorImpl.a(ContactsProcessorImpl.java:28)
at cz.kb.mba.core.shared.rest.dataaccess.UnsecuredRestProcessorImpl2$1.a(UnsecuredRestProcessorImpl2.java:45)
at cz.kb.mba.core.shared.rest.dataaccess.job.SimpleRestJob2.run(SimpleRestJob2.java:34)
at cz.kb.mba.core.shared.rest.dataaccess.RestJobExecutor$1.c(RestJobExecutor.java:37)
at com.path.android.jobqueue.BaseJob.a(BaseJob.java:108)
at com.path.android.jobqueue.JobHolder.a(JobHolder.java:60)
at com.path.android.jobqueue.executor.JobConsumerExecutor$JobConsumer.run(JobConsumerExecutor.java:201)
at java.lang.Thread.run(Thread.java:841)
Caused by: retrofit.converter.ConversionException: java.lang.RuntimeException: failure in processEncodedAnnotation
at retrofit.converter.SimpleXMLConverter.fromBody(SimpleXMLConverter.java:50)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:367)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at $Proxy18.a(Native Method)
at cz.kb.mba.core.contacts.dataaccess.ContactsProcessorImpl.a(ContactsProcessorImpl.java:41)
at cz.kb.mba.core.contacts.dataaccess.ContactsProcessorImpl.a(ContactsProcessorImpl.java:28)
at cz.kb.mba.core.shared.rest.dataaccess.UnsecuredRestProcessorImpl2$1.a(UnsecuredRestProcessorImpl2.java:45)
at cz.kb.mba.core.shared.rest.dataaccess.job.SimpleRestJob2.run(SimpleRestJob2.java:34)
at cz.kb.mba.core.shared.rest.dataaccess.RestJobExecutor$1.c(RestJobExecutor.java:37)
at com.path.android.jobqueue.BaseJob.a(BaseJob.java:108)
at com.path.android.jobqueue.JobHolder.a(JobHolder.java:60)
at com.path.android.jobqueue.executor.JobConsumerExecutor$JobConsumer.run(JobConsumerExecutor.java:201)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.RuntimeException: failure in processEncodedAnnotation
at java.lang.reflect.Field.getDeclaredAnnotations(Native Method)
at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:201)
at org.simpleframework.xml.core.FieldDetail.<init>(FieldDetail.java:57)
at org.simpleframework.xml.core.DetailScanner.fields(DetailScanner.java:428)
at org.simpleframework.xml.core.DetailScanner.scan(DetailScanner.java:367)
at org.simpleframework.xml.core.DetailScanner.<init>(DetailScanner.java:140)
at org.simpleframework.xml.core.DetailExtractor.getDetail(DetailExtractor.java:107)
at org.simpleframework.xml.core.Support.getDetail(Support.java:278)
at org.simpleframework.xml.core.Support.getDetail(Support.java:271)
at org.simpleframework.xml.core.ScannerFactory.getInstance(ScannerFactory.java:76)
at org.simpleframework.xml.core.Support.getScanner(Support.java:357)
at org.simpleframework.xml.core.Source.getScanner(Source.java:271)
at org.simpleframework.xml.core.Source.getSchema(Source.java:317)
at org.simpleframework.xml.core.Composite.read(Composite.java:198)
at org.simpleframework.xml.core.Composite.read(Composite.java:148)
at org.simpleframework.xml.core.Traverser.read(Traverser.java:92)
at org.simpleframework.xml.core.Persister.read(Persister.java:625)
at org.simpleframework.xml.core.Persister.read(Persister.java:606)
at org.simpleframework.xml.core.Persister.read(Persister.java:584)
at org.simpleframework.xml.core.Persister.read(Persister.java:543)
at retrofit.converter.SimpleXMLConverter.fromBody(SimpleXMLConverter.java:48)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:367)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at $Proxy18.a(Native Method)
at cz.kb.mba.core.contacts.dataaccess.ContactsProcessorImpl.a(ContactsProcessorImpl.java:41)
at cz.kb.mba.core.contacts.dataaccess.ContactsProcessorImpl.a(ContactsProcessorImpl.java:28)
at cz.kb.mba.core.shared.rest.dataaccess.UnsecuredRestProcessorImpl2$1.a(UnsecuredRestProcessorImpl2.java:45)
at cz.kb.mba.core.shared.rest.dataaccess.job.SimpleRestJob2.run(SimpleRestJob2.java:34)
at cz.kb.mba.core.shared.rest.dataaccess.RestJobExecutor$1.c(RestJobExecutor.java:37)
at com.path.android.jobqueue.BaseJob.a(BaseJob.java:108)
at com.path.android.jobqueue.JobHolder.a(JobHolder.java:60)
at com.path.android.jobqueue.executor.JobConsumerExecutor$JobConsumer.run(JobConsumerExecutor.java:201)
at java.lang.Thread.run(Thread.java:841)
以下是项目/构建配置的一些重要部分 SimpleXml导入:
compile('com.squareup.retrofit:converter-simplexml:1.9.0') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
Simplexml的Proguard配置 (我用Google搜索了更多规则但到目前为止没有任何效果):
# simplexml
-dontwarn org.simpleframework.xml.stream.StreamProvider
-dontwarn org.simpleframework.xml.stream.StreamReader*
-keep class org.simpleframework.xml.core.**{ *; }