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

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

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

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


当前回答

我也有同样的问题。当我检查时,我看到有两个类具有相同的名称,每个类在我添加的外部jar文件中。然后我必须删除一个jar文件。幸运的是,我得到了另一个jar文件1我已经删除。

其他回答

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

我遍历了这个答案中的步骤,仍然没有得到解决方案。我一直在网上搜索,发现如果你试图在Android设备连接到计算机时导出APK,就会得到这个错误。

断开我的设备,然后关闭项目,重新启动计算机,打开项目,然后清理它,这三次都发生了。

每次出现这种错误时,简单地清理项目对我来说都很有效。

在我的情况下,我有一个外部罐子添加。因此,我将外部jar位置移动到Project Prop中的android引用的顶部——>Java buildPath——>项目引用

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

这就是我遇到的问题:

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!