Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ksoap2 with proguard

I have an application that is using ksoap2 library, everything working fine but when exporting application from Eclipse, it shows this

Proguard returned with error code 1. See console
Note: there were 4 duplicate class definitions.
Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer
Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.content.res.ColorStateList depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.AnimationDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.ColorDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser

After browsing the ksoap2-android-assembly-3.1.1-jar-with-dependencies.jar I found that it has own org.xmlpull.v1 package and with 4 files those are already defined in android.jar since API 1.

Why did the author of ksoap added these classes if they existed already ? O_o if he had to do some changes it would be nice if package name was also changed.

Anyway, 2 things I can do to solve this. Either use -dontwarn in proguard config file. Which seems not a good idea. Or download the source code and delete that package name and build a jar.

Or maybe there is something else I can do ?

Thank you

like image 457
xmen Avatar asked Jan 14 '14 08:01

xmen


2 Answers

I had a similiar problem and I solved it using this:

-ignorewarnings
-keep class org.kobjects.** { *; }
-keep class org.ksoap2.** { *; }
-keep class org.kxml2.** { *; }
-keep class org.xmlpull.** { *; }
like image 175
Ton Avatar answered Oct 05 '22 18:10

Ton


Open .jar in Rar or any Zip application. Delete the xmlpull folder. Thats it :)

like image 25
xmen Avatar answered Oct 05 '22 18:10

xmen