Android:转换为 Dalvik 格式失败:无法执行 dex:null
我正在尝试在 Android 上使用 SmugFig SmugMug API。我想它是为 J2SE 设计的,所以我不确定它是否能在 Android 上工作,但我认为它值得尝试,而不是尝试创建我自己的 API。
当我加载项目时,我收到以下错误:
Conversion to Dalvik format failed: Unable to execute dex: null
它没有说明它在哪个包上失败,只是“Android 打包问题”,但在我将 SmugFig 及其依赖 JARS 添加到构建路径之前它没有这样做。
我应该去哪里看?或者这主要是因为它不适用于这些库?
I'm trying to use the SmugFig SmugMug 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.
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.
Where should I look? Or does this mainly me that it just won't work with those libraries?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
我发现一个博客条目说增加 eclipse.ini 中分配的内存:
-Xms128米
-Xmx512米
或更高的东西,但这并不适合我。
然而,我发现另一篇文章建议做 Project >干净,这为我解决了问题。
我认为当您关闭 Eclipse 而没有先关闭模拟器时就会发生这种情况。相当蹩脚的错误。今天早上花了几个小时寻找解决方案...grrrrrrr :-(
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.
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 :-(
转到项目 » 属性 » Java 构建路径 » 库并删除除“Android XY”(在我的例子中为 Android 1.5)之外的所有内容。单击“确定”。转到项目 » 清理 » 清理下面选择的项目 » 选择您的项目,然后单击确定。那应该有效。
您的项目文件夹中也可能有一个 JAR 文件(我已将 Admob JAR 文件复制到我的 src 文件夹中),然后将其添加为 Java 路径库。它不会显示在 Package Explorer 下,因此您不会注意到它,但它确实会被计数两次,从而导致可怕的 Dalvik 错误 1。
另一个可能的原因可能是包名称冲突。假设您有一个包 com.abc.xyz 和该包内一个名为 A.java 的类,以及另一个包含相同 com.abc.xyz.A.java 的库项目(已添加到该项目的依赖项中),那么你会得到完全相同的错误。这意味着,您对同一文件 A.java 有多个引用,并且无法正确构建它。
Go to Project » Properties » Java Build Path » Libraries and remove all except the "Android X.Y" (in my case Android 1.5). click OK. Go to Project » Clean » Clean projects selected below » select your project and click OK. That should work.
It is also possible that you have a JAR file located somewhere in your project folders (I had copied the Admob JAR file into my src folder) and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don't notice it, but it does get counted twice, causing the dreaded Dalvik error 1.
Another possible reason could be package name conflicts. Suppose you have a package com.abc.xyz and a class named A.java inside this package, and another library project (which is added to the dependency of this project) which contains the same com.abc.xyz.A.java, then you will be getting the exact same error. This means, you have multiple references to the same file A.java and can't properly build it.
在 Eclipse DDMS 更新 8.0.0 随 Android 2.3 发布后,突然出现此错误。
上述建议都没有帮助,但事实证明,问题的根源是引用的项目(服务器和客户端之间共享的一些类)。
一旦我删除了项目引用并构建并包含了曾经引用的项目的 jar,问题就不再存在。
DDMS 8.0.0 中引用的项目似乎出现了问题。
After the Eclipse DDMS update 8.0.0 came with the release of Android 2.3 this error suddenly appeared.
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.
Seems like something went rogue in DDMS 8.0.0 with referenced projects.
中的 android.jar 引用
对我有用的是删除配置构建路径 -> Java 构建路径 ->库
保留 Android 3.0 库参考。
What worked for me was removing the android.jar reference in
Configure Build Path -> Java Build Path -> Libraries
Leave the Android 3.0 library reference.
这只是因为一些 JAR 文件占用了堆大小...可以手动删除...
否则最好的选择是修改 eclipse 文件夹中的 Eclipse.ini 文件...
将 -Xmx1024m 添加到文件中将内存大小设置为 1 GB ...它肯定会工作......
its simply because of the Heap size occupied by some JAR files...which can be removed manually...
else the best option is to modify the Eclipse.ini file in the eclipse folder.....
add -Xmx1024m to the file to make the memory size to 1 GB ...it woul work for sure.....
帮助我删除此错误的步骤
希望这对您有帮助。
谢谢。
Steps that help me to remove this error
Hope this will be helpful to you.
Thanks.
http://groups.google.com/group/android-developers/browse_thread /thread/3911749addce534d
他们正在努力推动 2.3 的修复
编辑:这已在 2.3 中修复,请通过 eclipse 获取更新。
http://groups.google.com/group/android-developers/browse_thread/thread/3911749addce534d
They are working on pushing a fix now for 2.3
Edit: This has been fixed for 2.3 , go get the update via eclipse.
对我有用https://groups.google.com/forum/? fromgroups=#!topic/phonegap/yWePvssyiLE
works for me https://groups.google.com/forum/?fromgroups=#!topic/phonegap/yWePvssyiLE
确保您没有在 jar 和 eclipse 中引用相同的项目。例如,您在 eclipse 中有一个名为 myproject 的项目。您的 android 项目引用了 myproject 项目以及从中生成的 jar。当您尝试对 myproject 和 myproject.jar 生成的类进行 dex 时,这会出现错误
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
只有这样才能解决我的问题。项目>干净的
Only this solve my problem .Project > Clean
这里他们表明这些错误是由巨大的.java引起的文件。
我遇到了同样的问题,增加分配的内存对我有用。
Here they suggest that these error is caused by huge .java files.
I had the same problem and incrementing the memory allocated works for me.
我帮助删除 /home/user/.android 文件夹。
操作系统:Debian Wheezy 32位
I helper to remove /home/user/.android folder.
OS: Debian Wheezy 32bit
前面提到的“修复”绝对没有对我有用,这并不奇怪,因为它们甚至没有从一开始就解决问题。
该错误本身源于与 Proguard 的冲突。以下是错误报告:http://code.google.com/p /android/issues/detail?id=18359 要修复它,您只需手动更新 Proguard: http://sourceforge.net/projects/proguard/files/latest/download?source=files
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=18359 And to fix it, you simply need to manually update Proguard: http://sourceforge.net/projects/proguard/files/latest/download?source=files
对于使用
New Relic
的项目,通过 Project r'click -> 下的“Update New Relic”更新 New Relic
更新新遗物
。这对我有用。For projects which uses
New Relic
Update New Relic via "Update New Relic" under Project r'click ->
Update New Relic
. This worked for me.