在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(我目前使用的版本)。
当前回答
我个人通过手动编辑项目设法解决了这个问题。属性文件。
它是什么:
target=android-16
android.library.reference.1=..\\..\\github\\ActionBarSherlock\\library
android.library.reference.2=../../github/android-numberpicker/library
我把它改成这样问题就解决了
target=android-16
android.library.reference.1=../../github/ActionBarSherlock/library
android.library.reference.2=../../github/android-numberpicker/library
使用“修复项目属性”工具未自动修复此文件。
其他回答
Windows 7解决方案:
确认该问题是由文件中的ProGuard命令行导致的 [Android SDK安装目录]\tools\proguard\bin\proguard.bat
编辑下面这行就可以解决问题了:
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
to
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
上面列出的解决方案没有一个对我有效。
这就是我遇到的问题:
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!
我使用adt7和其他修复没有工作(但我仍然做了他们)。
然后我复制了proguard.cfg从另一个项目,并简单地粘贴到旧的ADT项目文件夹。哇,成功了。
我自己的解决方案,也是我今天在测试所有解决方案四个小时后发现的唯一解决方案,是以下提供的许多解决方案的组合:
从Eclipse中删除项目 从项目文件夹中删除\bin和\gen中的文件 将对库的引用删除到根项目文件夹的.classpath文件中 使用命令行重新启动Eclipse: Eclipse -clean 导入项目 右键单击项目-选择属性> Java Build Path > Libraries,删除除Android XX以外的所有内容。Y 最后清理项目,等待自动构建或构建它 启动,现在它工作了!至少对我来说……
我一次尝试了每一步,尝试了许多组合,但只有把所有的步骤同时进行才成功!我希望我不会再面对这种情况……
以上所有的解决方案都不适合我。我没有使用任何预编译的.jar。我使用的是LVL和Dalvik错误,所有这些都与市场许可库有关。
这个问题通过删除主项目并重新导入(从现有的资源中创建一个新项目)得到了解决。