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

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

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

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


当前回答

另一个机器人巫术的案例 如果其他方法都不管用,那就试试 将清单中的versionCode和versionName增加1。

这对我很管用。

其他回答

我解决了这个问题。

这是一个JAR文件冲突。

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

jar和android_maps_lib-1.0.2

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

我遇到了这个问题,因为Eclipse中的Android- maven -插件显然不能识别传递引用,并且从两个项目(包括一个Android库项目)中引用了两次引用,并且不止一次地包含它们。我不得不使用魔术使所有内容只包含一次,即使Maven应该处理所有这些。

例如,我有一个核心库globalmentor-core,它也被globalmentor-google和globalmentor-android使用(后者是一个Android库)。在globalmentor-android pom.xml中,我必须将依赖标记为“提供的”,并将其从其他库中排除。

    <dependency>
        <groupId>com.globalmentor</groupId>
        <artifactId>globalmentor-core</artifactId>
        <version>1.0-SNAPSHOT</version>
        <!-- android-maven-plugin can't seem to automatically keep this from being
             included twice; it must therefore be included manually (either explicitly
             or transitively) in dependent projects -->
        <scope>provided</scope>
    </dependency>

然后在最后的应用程序pom.xml中,我必须使用正确的技巧,只允许一个包含路径——以及不显式地包括核心库:

    <!-- android-maven-plugin can't seem to automatically keep this from being
        included twice -->
    <!-- <dependency> -->
    <!-- <groupId>com.globalmentor</groupId> -->
    <!-- <artifactId>globalmentor-core</artifactId> -->
    <!-- <version>1.0-SNAPSHOT</version> -->
    <!-- </dependency> -->

    <dependency>
        <groupId>com.globalmentor</groupId>
        <artifactId>globalmentor-google</artifactId>
        <version>1.0-SNAPSHOT</version>
        <exclusions>
            <!-- android-maven-plugin can't seem to automatically keep this from
                being included twice -->
            <exclusion>
                <groupId>com.globalmentor</groupId>
                <artifactId>globalmentor-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.globalmentor</groupId>
        <artifactId>globalmentor-android</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

您可以通过关闭菜单>“项目”>“自动构建”来轻松解决这个问题(使用Eclipse Android开发工具,构建:v22.0.1-685705),同时导出(unsigned) Android应用程序。之后,别忘了再打开它。

编辑(新解决方案):

看起来之前的解决方案只是一个旁路。我最终设法永久性地解决了这个问题: 在我的案例中,在我的项目中的android-support-v4文件和在我的项目中引用的Facebook项目中存在不匹配。

我通过执行Lint检查发现了这个错误(Android工具/运行Lint:检查常见错误)

我之前的解决方案:

我在这个网站上尝试了任何可能的解决方案-没有任何帮助!!

最后我在这里找到了答案: https://groups.google.com/forum/ !主题/ actionbarsherlock / drzI7pEvKd4

简单的步骤:

转到项目->取消勾选自动生成 进入项目->清洁…,清洁图书馆项目和你的 应用项目 导出您的应用作为一个签名APK,而自动构建仍然是 禁用

更新Proguard到最新版本为我解决了这个问题。

我的proguard路径是C:\Program Files (x86)\Android\ android-sdk\tools\proguard\ 我从这里下载了新版本 并替换了bin和lib文件夹

感谢上帝!