Java Android:转换为 Dalvik 格式失败:无法执行 dex:null
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2687773/
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
Android: Conversion to Dalvik format failed: Unable to execute dex: null
提问by Adam Haile
I'm trying to use the SmugFigSmugMug API on Android. It was designed for J2SE I would imagine, so I'm not sure it will even work on Android, but I figured it was worth trying as opposed to trying to create my own API.
我正在尝试在 Android 上使用SmugFigSmugMug API。我想它是为 J2SE 设计的,所以我不确定它甚至可以在 Android 上运行,但我认为与尝试创建自己的 API 相比,它值得尝试。
When I load the project though, I get the following error:
但是,当我加载项目时,出现以下错误:
Conversion to Dalvik format failed: Unable to execute dex: null
It doesn't say what package it fails on, just "Android Packaging Problem", but it did not do this before I added SmugFig and it's dependency JARS to the build path.
它没有说明它在哪个包上失败,只是“Android 打包问题”,但是在我添加 SmugFig 之前它没有这样做,并且它的依赖 JARS 到构建路径。
Where should I look? Or does this mainly me that it just won't work with those libraries?
我应该在哪里看?或者这主要是我认为它不适用于那些库吗?
回答by ken
I found a blog entry that says increase the memory allocated in eclipse.ini to this: -Xms128m -Xmx512m or something higher, but this didn't do it for me.
我找到了一个博客条目,上面写着将 eclipse.ini 中分配的内存增加到这个:-Xms128m -Xmx512m 或更高的东西,但这对我没有帮助。
However, I found another post that suggested doing Project > Clean and that fixed it for me. I think it happens when you shut down Eclipse w/o shutting the emulator down first. Pretty lame bug. Spent a few hours digging for the solution this morning...grrrrrrr :-(
但是,我发现另一篇文章建议执行 Project > Clean 并为我修复了它。我认为当您关闭 Eclipse 而不先关闭模拟器时会发生这种情况。相当蹩脚的虫子。今天早上花了几个小时寻找解决方案...... grrrrrrr :-(
回答by Julio J.
回答by monsta
After the Eclipse DDMS update 8.0.0 came with the release of Android 2.3 this error suddenly appeared.
在 Eclipse DDMS 更新 8.0.0 随 Android 2.3 发布后,此错误突然出现。
None of the above suggestions helped, but it turned out that the root of the problem was a referenced project (a few classes shared between the server and client sides).
上述建议都没有帮助,但事实证明问题的根源是引用的项目(服务器端和客户端之间共享的几个类)。
Once I removed the project reference and built and included a jar of the once referenced project the problem ceased to exist.
一旦我删除了项目引用并构建并包含了一个曾经引用过的项目的 jar,问题就不再存在了。
Seems like something went rogue in DDMS 8.0.0 with referenced projects.
DDMS 8.0.0 中引用的项目似乎有些问题。
回答by joe
http://groups.google.com/group/android-developers/browse_thread/thread/3911749addce534d
http://groups.google.com/group/android-developers/browse_thread/thread/3911749addce534d
They are working on pushing a fix now for 2.3
他们现在正在努力推动 2.3 的修复
Edit: This has been fixed for 2.3 , go get the update via eclipse.
编辑:这已针对 2.3 修复,请通过 eclipse 获取更新。
回答by charroch
Ensure you don't reference the same project within a jar and eclipse. For instance, you have a project called myproject in eclipse. Your android project references both myproject project and the jar generated from it. This will give an error when you try to dex as it tries to dex against the generated classes from myproject and from the myproject.jar
确保您不在 jar 和 eclipse 中引用同一个项目。例如,您在 eclipse 中有一个名为 myproject 的项目。您的 android 项目同时引用了 myproject 项目和从中生成的 jar。这将在您尝试 dex 时出现错误,因为它尝试针对 myproject 和 myproject.jar 中生成的类进行 dex
回答by GeX
I helper to remove /home/user/.android folder. OS: Debian Wheezy 32bit
我帮手删除 /home/user/.android 文件夹。操作系统:Debian Wheezy 32 位
回答by Regish K Nair
its simply because of the Heap size occupied by some JAR files...which can be removed manually...
这仅仅是因为一些 JAR 文件占用的堆大小......可以手动删除......
else the best option is to modify the Eclipse.ini file in the eclipse folder.....
否则最好的选择是修改eclipse文件夹中的Eclipse.ini文件.....
add -Xmx1024m to the file to make the memory size to 1 GB ...it woul work for sure.....
将 -Xmx1024m 添加到文件中,使内存大小为 1 GB ......它肯定会工作......
回答by Arunabh Das
What worked for me was removing the android.jar reference in
对我有用的是删除 android.jar 中的引用
Configure Build Path -> Java Build Path -> Libraries
配置构建路径 -> Java 构建路径 -> 库
Leave the Android 3.0 library reference.
保留 Android 3.0 库参考。
回答by b1nary.atr0phy
Absolutely none of the previously mentioned "fixes" have worked for me, which comes as no surprise because they aren't even addressing the problem to begin with.
绝对没有前面提到的“修复”对我有用,这并不奇怪,因为他们甚至没有从一开始就解决问题。
The bug itself stems from a conflict with Proguard. Here is the bug report: http://code.google.com/p/android/issues/detail?id=18359And to fix it, you simply need to manually update Proguard: http://sourceforge.net/projects/proguard/files/latest/download?source=files
该错误本身源于与 Proguard 的冲突。这是错误报告:http: //code.google.com/p/android/issues/detail?id =18359 要修复它,您只需手动更新 Proguard:http: //sourceforge.net/projects/ proguard/files/latest/download?source=files
回答by salman khalid
Only this solve my problem .Project > Clean
只有这样才能解决我的问题。Project > Clean