2012-05-19 40 views
19

我使用ProGuard總是得到以下錯誤:ProGuard的錯誤不能找到超類或接口org.apache.http.entity

[2012-05-19 17:50:13 - xxx] Warning: there were 13 unresolved references to  program class members. 
[2012-05-19 17:50:13 - xxx]   Your input classes appear to be  inconsistent. 
[2012-05-19 17:50:13 - xxx]   You may need to recompile them and try again. 
[2012-05-19 17:50:13 - xxx]   Alternatively, you may have to specify the option 
[2012-05-19 17:50:13 - xxx]   '-dontskipnonpubliclibraryclassmembers'. 
[2012-05-19 17:50:13 - xxx] Error: Please correct the above warnings first. 
[2012-05-19 17:55:40 - xxx] Proguard returned with error code 1. See console 
[2012-05-19 17:55:40 - xxx] Note: there were 239 duplicate class definitions. 
[2012-05-19 17:55:40 - xxx] Warning: org.apache.http.entity.mime.FormBodyPart: can't find superclass or interface org.apache.james.mime4j.message.BodyPart 
[2012-05-19 17:55:40 - xxx] Warning: org.apache.http.entity.mime.HttpMultipart: can't find superclass or interface org.apache.james.mime4j.message.Multipart 
[2012-05-19 17:55:40 - xxx] Warning: org.apache.http.entity.mime.MinimalField: can't find superclass or interface org.apache.james.mime4j.parser.Field 

我proguard.cfg文件是:

-keep class android.support.v4.app.** { *; } 
-keep interface android.support.v4.app.** { *; } 
-keep class com.actionbarsherlock.** { *; } 
-keep interface com.actionbarsherlock.** { *; } 

-keepattributes *Annotation* 
-keepattributes SourceFile, LineNumberTable 

-libraryjars /libs/crittercism_v2_0_1.jar 
-libraryjars /libs/dropbox-android-sdk-1.2.2.jar 
-libraryjars /libs/FlurryAgent.jar 
-libraryjars /libs/httpmime-4.0.3.jar 
-libraryjars /libs/json_simple-1.1.jar 

我我已經添加了所有外部庫,那麼爲什麼我總是會遇到這些錯誤? 任何人都可以幫忙嗎?

編輯21.05.2012: 問題是如果您添加「Dropbox」jar和「ActionBarSherlock」。 如果我只添加「Dropbox」,我沒有問題。 如果我只添加「ActionBarSherlock」,我沒有問題。 但是,如果我加了兩個,我會得到上面的錯誤。

回答

35

如果您已將「ActionBarSherlock」和「DropBox」罐子添加到您的項目,則存在問題。 爲了解決這個問題,下面的行添加到您的ProGuard-project.txt文件:

-dontwarn org.apache.** 

警告會被忽略,它會工作,因爲每個單獨的罐子都在工作。 所以我認爲,這將是ProGuard中的錯誤,如果兩者都添加的話。

+0

它不工作,錯誤是:警告:aa $ a:無法找到程序類中的引用字段'org.apache.http.HttpEntity wrappedEntity'aa $ a – Kenji

+0

@Kenji:對不起,我沒有再使用ActionBarSherlock,所以我幫不了你。 – chrisonline

+0

@BinilS:你的意思是「API不會使用org.apache調用」? – chrisonline

8

可能你需要:

-keep class org.apache.http.**

-keep interface org.apache.http.**

這是假設當然ProGuard的是抱怨阿帕奇類。無可否認,我有點猜測,因爲我不是ProGuard的專家。

+0

是的,我認爲這是一個解決方案,但我不想保留它,因爲我不使用它。和所有外部罐子我已經添加到圖書館!那麼,爲什麼我得到這個錯誤? – chrisonline

+0

你可能沒有選擇。在ProGuard示例頁面上查看是否有幫助? http://proguard.sourceforge.net/index.html#manual/examples.html – Kerry

+1

我試過了,但它不起作用。同樣的錯誤... – chrisonline

相關問題