关于conversion to dalvik format failed with error

来源:互联网 发布:wap手机彩票源码 编辑:程序博客网 时间:2024/05/18 01:51
关于conversion to dalvik format failed with error 1

最近总是遇到这个问题,好几次了。今天终于找到原因了。真纠结啊。。。


trouble processing "java/nio/CharBuffer.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)     when not building a core 
library.
This is often due to inadvertently including a core library file   
[apply] in your application's project, when using an IDE (such as   
[apply] Eclipse). If you are sure you're not intentionally defining a   
[apply] core class, then this is the most likely explanation of what's   
[apply] going on.

However, you might actually be trying to define a class in a core    [apply] namespace, the 
source of which you may have taken, for example,    [apply] from a non-Android virtual machine 
project. This will most    [apply] assuredly not work. At a minimum, it jeopardizes the    
[apply] compatibility of your app with future versions of the platform.    [apply] It is also 
often of questionable legality.    [apply]     [apply] If you really intend to build a core 
library -- which is only    [apply] appropriate as part of creating a full virtual machine    
[apply] distribution, as opposed to compiling an application -- then use    [apply] the "--
core-library" option to suppress this error message.    [apply]     [apply] If you go ahead 
and use "--core-library" but are in fact    [apply] building an application, then be 
forewarned that your application    [apply] will still fail to build or run, at some point. 
Please be    [apply] prepared for angry customers who find, for example, that your    [apply] 
application ceases to function once they upgrade their operating    [apply] system. You will 
be to blame for this problem.    [apply]     [apply] If you are legitimately using some code 
that happens to be in a    [apply] core package, then the easiest safe alternative you have is 
to    [apply] repackage that code. That is, move the classes in question into    [apply] your 
own package namespace. This means that they will never be in    [apply] conflict with core 
system classes. JarJar is a tool that may help    [apply] you in this endeavor. If you find 
that you cannot do this, then    [apply] that is an indication that the path you are on will 
ultimately    [apply] lead to pain, suffering, grief, and lamentation.

这个错误是由于错误的添加了不必要的core library,我是多添加了Android.jar之后报错,把不要用掉的
包给去掉就好了。我本来把android.jar已经单独弄成了一个User Library了,最后还用add extenerl jar
的方式添加了它,所以错了,删除多余的android.jar就ok。下面是一些解决办法,我开始弄了一会,不行。

android低版本工程(如1.5)放到高版本环境中(如2.2)可能会上述错误,解决方法如下:
1。 如果不修改android sdk版本,则使用project clean 命令作用于某工程即可。
       (该处理方式只是在高版本中兼容了低版本工程,未真正意义上的升级)
2。 如果修改android sdk版本,则需要以下几个步骤:
       1)修改SDK
             选择工程,build path --> configure build path ---> library 删除引用的低版本SDK,
             然后add External JARs,选择高版本SDK,OK,保存
        2)修改classpath文件 
             该文件可能存在该项: <classpathentry kind="lib"   path ="你所指定的高版本的地址"
             把她修改成<classpathentry kind="con" 
path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK" />
        3) 修改AndroidManifest.xml
             在AndroidManifest.xml文件中,application标签后添加<uses-sdk 
android:minSdkVersion="3"></uses-sdk>
        4) 修改default.properties(很重要)
              该文件最后一行(前面没用#的)target=android-3 该成target=android-8,保存。
        再看看你的工程和新建的android 2.2的工程结构就一样了。
0 0