ProGuard错误找不到超类或接口org.apache.http.entity

chr*_*ine 21 android proguard

我总是在ProGuard出现以下错误:

[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
Run Code Online (Sandbox Code Playgroud)

我的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
Run Code Online (Sandbox Code Playgroud)

我已经添加了所有外部库,为什么我总是得到这些错误?有人可以帮忙吗?

编辑21.05.2012: 问题是如果你添加"Dropbox"jar和"ActionBarSherlock".如果我只添加"Dropbox",我没有问题.如果我只添加"ActionBarSherlock",我没有问题.但如果我同时添加两者,我会得到上面的错误.

chr*_*ine 38

如果您已将"ActionBarSherlock"和"DropBox"jar添加到项目中,则存在问题.要解决此问题,请将以下行添加到proguard-project.txt文件中:

-dontwarn org.apache.**
Run Code Online (Sandbox Code Playgroud)

该警告将被忽略,它将起作用,因为每个罐子都在工作.所以我认为,如果两者都添加,这将是ProGuard中的错误.


Ker*_*rry 9

可能你需要:

-keep class org.apache.http.**

-keep interface org.apache.http.**

当然假设ProGuard抱怨apache类.不可否认,我有点猜测,因为我不是ProGuard的专家.

  • 我的确可能是错误的答案,但关闭警告也不是一个好主意,你只是隐藏我认为的问题.需要进一步调查问题以理解它. (3认同)