今天終于完成了近一個月的app開發工作,對程式進行混淆導出簽名apk包時,卻出現了如下的錯誤:
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
。。。
心裡想着,真是好事多磨呀!
那就趕緊問度娘呀,終于在一位網友那裡找到了答案。
對于android導入了第三方jar包時,proguard混淆腳本會出現錯誤,而出現上面的錯誤是因為程式中引入了第三方jar包[ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar],二話不說,立馬行動:
在proguard-project.txt中增加了
-ignorewarnings
-libraryjars lib/ksoap2-android-assembly-2.5.4-jar-with-dependencies.jar (jar包路徑)
即在檔案中增加了如下紅色的兩行:
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
# optimization is turned off by default. dex does not like code run
# through the proguard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
#-dontoptimize
# note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.
-libraryjars libs/ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar
-keepattributes *annotation*
-keep public class com.google.vending.licensing.ilicensingservice
-keep public class com.android.vending.licensing.ilicensingservice