5

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

xmen
  • 1,947
  • 2
  • 25
  • 47

2 Answers2

4

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.** { *; }
Ton
  • 9,235
  • 15
  • 59
  • 103
  • In https://www.guardsquare.com/en/products/proguard/manual/troubleshooting#duplicateclass it is written: `You should also not add libraries to your application that are already part of the Android runtime (notably ... org.xmlpull.v1, ...). They are possibly inconsistent, and the runtime libraries would get precedence anyway`. It works, but ignores ProGuard warnings. So, it is better change the library source, as written in the accepted answer. – CoolMind Oct 10 '18 at 11:04
3

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

xmen
  • 1,947
  • 2
  • 25
  • 47