在Eclipse中的Android应用程序中,我得到了以下错误。
意想不到的顶级异常: java.lang.IllegalArgumentException:已添加:Lorg/xmlpull/v1/XmlPullParser; .... 转换到Dalvik格式失败,错误1
此错误仅在向项目添加特定的外部JAR文件时出现。我花了很长时间寻找可能的解决方案,但没有一个可行。
我甚至尝试将Android 1.6而不是1.5(我目前使用的版本)。
在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文件中。然后我必须删除一个jar文件。幸运的是,我得到了另一个jar文件1我已经删除。
对我有效的方法如下:
完全清理构建 删除无关的android.jar文件,我发现在项目/属性/库。
我知道这个问题已经有答案了,但这是我的解决方案:
我的Android项目来自一个Subversion存储库,我刚刚做了Checkout as a New project。我必须手动将我的库(Android和Java)添加到构建路径,否则它不会让我编译。然后我就会得到上面的错误。
我必须创建一个新的Android项目,然后手动复制更改。
我在这里没有工作,我不得不改变我的proguard文件添加这一行:
-keep class !mycode.** { *; }
它保留了任何不是我的包的代码。
-从你的java Build路径中移除所有的库。再加一次。 -清理你的项目。
运行它。