Android Proguard with external jar

风格不统一 提交于 2019-11-28 18:51:13

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.

com.itextpdf.text.BaseColor is included in the jar you have added, I guess. It extends java.awt.Color which is not included in it but in the distribution of Java you are using under Eclipse.

When you are exporting the file, the export process is jammed as java.awt.color doesn't exist in the Android base framework. I don't think this is related to Proguard: this must happen even if you disable the obfuscation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!