Problem with Proguard and XmlPullParser

后端 未结 4 1589
北恋
北恋 2021-01-18 17:03

I\'m having a bit of trouble on an Android project using Proguard with some libraries. Specifically, i\'m having an XmlPullParser collision, and no matter what i seem to do,

4条回答
  •  日久生厌
    2021-01-18 17:38

    Your ProGuard configuration and build process seem to be mixing up program jars and library jars.

    For ProGuard, you can probably specify all the listed jars as input jars (with -injars). Their processed versions will end up in the output jar (-outjars).

    You can indeed avoid warnings about duplicate xmlpull classes by filtering them out of android.jar. ProGuard will also print out warnings should there be any duplicates in the input jars. You can then filter out those duplicates as well.

    You should not specify /lib/rt.jar as a library jar, since this jar is not present as a library on Android devices either. Some of the listed jars depend on it though, so at least parts of them are not entirely compatible with the Android runtime. The cleanest solution to avoid warnings about offending classes is to filter them out of the corresponding input jars (e.g. a filter !com/thoughtworks/xstream/converters/extended/ColorConverter.class). Alternatively, you can bluntly switch off these warnings (e.g. -dontwarn com.thoughtworks.xstream.converters.extended.ColorConverter).

    For the Dalvik compiler, you should only specify the processed output jar, not any of the program jars that went into it. Otherwise, you will get duplicate classes: some unprocessed copies and some partly obfuscated copies. They don't blend and lead to Error1 and NoSuchMethodErrors.

提交回复
热议问题