當我的應用程序使用ProGuard構建時,它會失敗並顯示以下消息。 我使用Android SDK生成的默認proguard.cfg和一些-libraryjars。 我能爲它做些什麼?Android ProGuard error with org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Proguard returned with error code 1. See console
[2011-03-17 09:27:04 - MyProject] Note: there were 4247 duplicate class definitions.
[2011-03-17 09:27:04 - MyProject] Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.AnimationDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2011-03-17 09:27:04 - MyProject] You should check if you need to specify additional program jars.
[2011-03-17 09:27:04 - MyProject] Warning: there were 9 instances of library classes depending on program classes.
[2011-03-17 09:27:04 - MyProject] You must avoid such dependencies, since the program classes will
[2011-03-17 09:27:04 - MyProject] be processed, while the library classes will remain unchanged.
[2011-03-17 09:27:04 - MyProject] java.io.IOException: Please correct the above warnings first.
[2011-03-17 09:27:04 - MyProject] at proguard.Initializer.execute(Initializer.java:321)
[2011-03-17 09:27:04 - MyProject] at proguard.ProGuard.initialize(ProGuard.java:211)
[2011-03-17 09:27:04 - MyProject] at proguard.ProGuard.execute(ProGuard.java:86)
[2011-03-17 09:27:04 - MyProject] at proguard.ProGuard.main(ProGuard.java:492)
顯然,org.xmlpull.v1.XmlPullParser不是一個程序類。 我已將ProGuard更新至最新版本(4.6),但具有相同的警告。
埃裏克,他(或在任何情況下,我)在一罐XmlPullParser類在他的庫是這樣的原因它會覆蓋Android內置的XmlPullParser類,這是缺乏一些用途。由於我們在Android上制定proguard.cfg的方式,不可能過濾出內置的程序,我們也不想過濾出更好的AFAIK。如果可能的話,推出我們自己的Android JAR也不太明智。我們應該如何處理?謝謝 – pjv 2011-06-13 18:12:54
如果你的程序jar包含更好的實現,你應該嘗試用「-libraryjars android.jar(!org/xmlpull/v1/**)」來過濾庫版本,所以ProGuard得到乾淨的輸入。如果這是不可能的,你可以指定類似「-dontwarn org.xmlpull.v1。**」。它應該在這種情況下工作,因爲ProGuard使程序類優先於庫類。 – 2011-06-15 22:33:21