java 无法执行 dex 并转换为 Dalvik 格式失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15453177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 19:39:21  来源:igfitidea点击:

Unable to execute dex & Conversion to Dalvik format failed

javaandroiddependencies

提问by GuilhE

I've seen this question being asked and answered a few times but it didn't work for me. Eclipse is throwing:

我已经看到这个问题被问过并回答了几次,但它对我不起作用。Eclipse 正在抛出:

[2013-03-16 17:45:34 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[2013-03-16 17:45:34 - my-app-phone] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

Some say that's a build path issue caused by having bin folder included in your build path. Others say to increase the memory allocated in eclipse.ini to -Xms128m -Xmx512m or something higher, but this didn't do it for me either.

有人说这是构建路径中包含 bin 文件夹导致的构建路径问题。其他人说要将 eclipse.ini 中分配的内存增加到 -Xms128m -Xmx512m 或更高的值,但这对我来说也没有做到。

This is the only project throwing this error and it only happens with my Win 7 Pro at home. At work I've Mac OSX Mountain Lion and works fine.

这是唯一一个抛出这个错误的项目,它只发生在我家里的 Win 7 Pro 上。在工作中,我使用 Mac OSX Mountain Lion 并且工作正常。

AndroidJava Build Path SourceJava Build Path LibsJava Build Path Source Order and Export

安卓Java 构建路径源Java 构建路径库Java 构建路径源顺序和导出

What could it be? Thanks for your time.

会是什么呢?谢谢你的时间。

回答by GuilhE

While I was editing my screen shots I've found what could be causing this problem.

在编辑屏幕截图时,我发现了可能导致此问题的原因。

Problem

问题

As you can seen I had two android-support-v4.jar. I've removed android-support-v4.jar, clean FacebookSDK project and my my-app-phoneproject launched correctly.

如您所见,我有两个android-support-v4.jar。我已经删除了 android-support-v4.jar、clean FacebookSDK 项目和我的my-app-phone项目正确启动。

[2013-03-16 18:37:23 - my-app-phone] ------------------------------
[2013-03-16 18:37:23 - my-app-phone] Android Launch!
[2013-03-16 18:37:23 - my-app-phone] adb is running normally.




ps:




附:

enter image description hereenter image description hereenter image description here

在此处输入图片说明在此处输入图片说明在此处输入图片说明

Hope it helps!
Take care ;)

希望能帮助到你!
小心 ;)

回答by rana

just Delete android-support-v4.jar from libs folder it solve

只需从它解决的 libs 文件夹中删除 android-support-v4.jar

回答by user1028741

I had an old version of Admob (which comes in a different file name: "GoogleAdMobAdsSdk-6.0.1.jar" I removed it, and it solved the problem.

我有一个旧版本的 Admob(它有一个不同的文件名:“GoogleAdMobAdsSdk-6.0.1.jar”我删除了它,它解决了问题。

回答by user903697

I have the same problem. In case of me, first i create the project that support android4.x.x, but then I have to support Android5.0.1. The problem is project has both android-support-v4.jar and Android5.0.1/android.jar. So When I delete android-support-v4.jar the problem solved. Now I can test the project on my device.

我也有同样的问题。就我而言,首先我创建了支持 android4.xx 的项目,然后我必须支持 Android5.0.1。问题是项目同时具有 android-support-v4.jar 和 Android5.0.1/android.jar。所以当我删除 android-support-v4.jar 时,问题就解决了。现在我可以在我的设备上测试该项目。

回答by Martin Koubek

In my case, I had to remove Android Private Libraries, see pic:

就我而言,我必须删除 Android 私有库,请参见图片:

enter image description here

在此处输入图片说明