在Eclipse中的Android应用程序中,我得到了以下错误。

意想不到的顶级异常: java.lang.IllegalArgumentException:已添加:Lorg/xmlpull/v1/XmlPullParser; .... 转换到Dalvik格式失败,错误1

此错误仅在向项目添加特定的外部JAR文件时出现。我花了很长时间寻找可能的解决方案,但没有一个可行。

我甚至尝试将Android 1.6而不是1.5(我目前使用的版本)。


当前回答

只需要清理项目

如果这行不通,试试其他的解决方案

其他回答

上面列出的解决方案没有一个对我有效。

这就是我遇到的问题:

I added the jSoup external JAR file to my project's path by first putting it in a source folder called "libs", and then right clicking on it, Build Path -> add to build path. This threw the Dalvik conversion error. It said I had "already included" a class from that JAR file. I looked around the project's directory and found that the place where it was "already included" was in fact the bin directory. I deleted the JAR file from the bin directory and refreshed the project in Eclipse and the error went away!

对于我来说,在我的构建路径中出现了一个额外的JAR引用。我把这个删了,现在可以用了。

我在这里没有工作,我不得不改变我的proguard文件添加这一行:

-keep class !mycode.** { *; }

它保留了任何不是我的包的代码。

我解决了这个问题。

这是一个JAR文件冲突。

我的构建路径上似乎有两个包含相同包和类的JAR文件。

jar和android_maps_lib-1.0.2

从一个JAR文件中删除这个包就解决了这个问题。

如果你有ADT版本12+,你应该更新你的防护从4.4 -> 4.6(如这里所述)。此外,您应该以原始形式保留…\bin\proguard.bat文件。

只需从网上下载它,并复制lib文件夹从下载包到:

[Android SDK安装目录]\tools\proguard\lib