Conversion to Dalvik format failed with error 1 剖析与解决之道

该文章摘自国外论坛  

  This error also comes when you change target platform or changing workspace or some library and it will be fixed by doing clean and rebuild. But i was not able to find exact reason behind this error what is dalvik format then have realized that i need to read some documentation of android application framework and about dalvik virtual Machine. 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. Solution So please clean your project and rebuild it when you are getting this exception but when some classes which can not be converted to dex format are used then you can not use those classes in Android application.

你可能感兴趣的:(conversion)