Conversion to Dalvik format failed: Unable to execute dex
2013-12-12 20:20
369 查看
Error处理:Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException.
分类: Android 动手操作2013-11-1219:31 5045人阅读 评论(7) 收藏 举报
Error处理:Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException.
导入Eclipse Android2.X项目后运行,提示报错:
Console中提示:
通过clean up,fix project之后问题均不能解决。
网上还看到有人说,是因为Eclipse stack的问题,调整之后可以解决问题;按此提示,eclipse.ini的内容如下:
[html] view
plaincopy
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512m
-Xmx1024m
重启eclipse之后,运行,问题依旧。
如何解决?
之前也遇到过代码没有错误,就是编译运行时报错的情况。之前是因为引用第三方jar造成的,引用方式不对造成的,结合目前的状况,
后来goolge上看到:http://code.google.com/p/android/issues/detail?id=20398帖子中的:
[html] view
plaincopy
Here is differences between old and new:
(old)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="andengine_src"/> <!-- NOTICE THIS LINE -->
<classpathentry kind="output" path="bin"/>
</classpath>
(new)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <!-- NOTICE THIS LINE -->
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Also, new .project file does not contain <linkedResources> section
认为下面调整引用库的方式比较靠谱。于是根据这个思想进行调整项目的.classpath
我的.classpath文件内容如下:
[html] view
plaincopy
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="lib" path="libs/achartengine-1.1.0.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
调整之后如下:
[html] view
plaincopy
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/achartengine-1.1.0.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
之后Refresh--->>Clean UP--->>运行项目,一切正常,至此问题解决。
----------
备注说明:
对于这个问题,发现在升级SDK Tool到22.3之后,也就是Android 4.4的SDK及工具之后,加载之前老版本的项目都会出现这个问题。
关键是要将.classpath文件中的:
[html] view
plaincopy
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
· 去掉,之后clean up整个项目,再重新编译即可。
后续说明(2013年11月20日):
对于这个问题,最近大家可能比较苦恼,我也发现并不是所有的项目都会出现这个问题,对于具体差异和原因有待以后遇到再深入探究吧。
不过遇到这个问题的项目,凡是经过以下方法处理的都能够正常进行编译和运行。
1、找到你的项目
2、点击右键
3、打开Properties属性项
4、选中左边Java Build Path项,并在该选项中打开Libraries选项卡,如上图中,将Android Dependencies项和Android Private Libraries这两项Remove掉。
5、Clean up该项目
6、重新编译运行。
转自老兄 /article/7642686.html 手动添加链接真麻烦啊。
相关文章推荐
- 自己搭建的邮件系统不能发往gmail、hotmail等问题解决
- Http details
- 新浪微博failed to receive access token
- Page Cache, the Affair Between Memory and Files
- What Your Computer Does While You Wait
- 转载 IBM AIX系统重新查找存储链路
- How to send email via Django?
- 关于SAE的Email到达率很低的解决方案
- vs2008编译时出现问题解决方法:MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 r
- 见过有三个参数的main函数吗——main(int argc, char *argv[], char *env[])
- "No cache or cacheManager properties have been set. Authorization cache cannot be obtained."
- rails acts_as_nested_set
- hdu 4810 Wall Painting
- JetBrains的pycharm修改IDE的字体大小
- RAID详解[RAID0/RAID1/RAID10/RAID5]
- CF 314D Sereja and Straight Lines(旋转坐标轴+二分)
- Grails 在HttpSessionListener中使用service
- BZOJ 2434 阿狸的打字机(fail树)
- Invalid command &#39;RailsBaseURI&#39;
- uva10900 - So you want to be a 2n-aire? 概率 递推