"Conversion to Dalvik format failed with error 1"的解决

上一篇 / 下一篇  2012-09-03 09:44:38 / 个人分类:问题解决


运行Android测试程序时,遇到这个问题,搜索网上发现基本意思都是在说,可能是引用的包重复造成的,
于是不断排查对包的引用,原因终于浮出水面:)

原因:
应用的环境变量里面既配置了对另外一个app的依赖,同时又引入了该app的jar包


解决办法:
1、app-->Properties-->Java Build Path-->Projects中删除对其它app的依赖。


额外收获:

What is Dalvik Format ?

Dalvik is a virtual machine on Android OS which is register based while other Virtual machines are stack based. Dalvik Virtual Machine is a register based VM is optimized for low memory and processing retirements and OS can run multiple instance of VM to provide isolation of processes. Dalvik VM actually not executes java byte code classes but it executes Dex (Dalvik Execution Format) format classes.
To convert java class to Dex android sdk provides DX tool which converts regular java byte code classes to .dex format classes. Dex file contains more than one class and usually size is less than normal java compressed jar file.

Why “conversion to dalvik format failed with error 1” occurs?

But this DX tool can not convert all java classes to dex format then this error occurs. In my case when i was getting error because there are some class which are using Java standard edition references and can not converted to dex. Generally it will convert all J2Me lib to dex format.
Second scenario is that when you are changing target platform. or work space then there might be some inconsistency in build and it was fixed by just cleaning and rebuilding workspace.



TAG:

 

评分:0

我来说两句

Open Toolbar