Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Proguard with external jar

I'm have added external jar file to the libs folder of mt project and configure it in the build path. When i try to "Export Android Package" i receive a Proguard error message for a lot of reference classes that aren't found, For example: Warning: com.itextpdf.text.BaseColor: can't find referenced class java.awt.Color

When i tried to debug the BaseColor class worked fine, so i can't figure out why does it warns me.

Any help will be appreciated,

Thanks

like image 492
Moshik L Avatar asked Jul 29 '11 08:07

Moshik L


1 Answers

I tried for days to get external jars properly working. There were suggestions to do things like download the referenced JARS or properly define libjars. None of these worked for me.
What did work was putting this sort of thing in for the JARS that errored:

-dontwarn javax.management.**
-dontwarn java.lang.management.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.slf4j.**
-dontwarn org.json.*

and this:

-keep class javax.** { *; }
-keep class org.** { *; }
-keep class twitter4j.** { *; }

(Obviously you will need to adjust this to match your error messages)

Good luck.

like image 144
Caspar Harmer Avatar answered Oct 14 '22 21:10

Caspar Harmer