Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ProGuard error with org.xmlpull.v1.XmlPullParser

When my application is build with ProGuard, it fails with following message. I use a default proguard.cfg generated by Android SDK with some -libraryjars. What can I do for it?

[2011-03-17 09:27:04 - MyProject] Proguard returned with error code 1. See console
[2011-03-17 09:27:04 - MyProject] Note: there were 4247 duplicate class definitions.
[2011-03-17 09:27:04 - MyProject] Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.AnimationDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject]       You should check if you need to specify additional program jars.
[2011-03-17 09:27:04 - MyProject] Warning: there were 9 instances of library classes depending on program classes.
[2011-03-17 09:27:04 - MyProject]          You must avoid such dependencies, since the program classes will
[2011-03-17 09:27:04 - MyProject]          be processed, while the library classes will remain unchanged.
[2011-03-17 09:27:04 - MyProject] java.io.IOException: Please correct the above warnings first.
[2011-03-17 09:27:04 - MyProject]   at proguard.Initializer.execute(Initializer.java:321)
[2011-03-17 09:27:04 - MyProject]   at proguard.ProGuard.initialize(ProGuard.java:211)
[2011-03-17 09:27:04 - MyProject]   at proguard.ProGuard.execute(ProGuard.java:86)
[2011-03-17 09:27:04 - MyProject]   at proguard.ProGuard.main(ProGuard.java:492)

Apparently, org.xmlpull.v1.XmlPullParser is not a program class. I've updated ProGuard to newest version(4.6), but have same warnings.

like image 498
Nuree Son Avatar asked Mar 17 '11 01:03

Nuree Son


2 Answers

add this line to proguard-project.txt

-dontwarn org.xmlpull.v1.**

and this line to project.properties

proguard.config=proguard-project.txt
like image 145
Medo Elkamaly Avatar answered Oct 05 '22 20:10

Medo Elkamaly


I solved this using this settings in the proguard file:

-dontwarn org.kobjects.**
-dontwarn org.ksoap2.**
-dontwarn org.kxml2.**
-dontwarn org.xmlpull.v1.**

-keep class org.kobjects.** { *; }
-keep class org.ksoap2.** { *; }
-keep class org.kxml2.** { *; }
-keep class org.xmlpull.** { *; }

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontoptimize
-dontpreverify
like image 39
Ton Avatar answered Oct 05 '22 18:10

Ton