问题1:导入旧工程失败
描述:File→New→Project→Android Project from Existing Code,然后报错:Invalid
project description.
解决方案1:将旧工程的路径改为非workspace的路径,然后选择File→New→Project→Android Project
from Existing Code,在导入时,勾选Copy projects into workspace选项
解决方案2:File→New→Android Application
Project,建立新的工程,然后删除新工程目录下所有的文件,将旧项目文件拷入,并刷新工程
问题2:AndroidManifest.xml编译不通过
描述:Android Manifest报错
解决方案:
1.检查AndroidManifest.xml,看看是不是存在版本问题:可建立一个新项目,比比新的AndroidManifest.xml在格式上与旧版的有什么区别,修改一下
2.如果在问题1中使用了第二种解决方案,检查AndroidManifest.xml中minSdkVersion和targetSdkVersion与新建项目时选择的有什么出入;然后如果没有解决问题,右键→Properties→Android(或者用文本编辑器打开project.properties),检查target与新建项目时选择的有什么出入
问题3:其他源代码编译不通过
描述:The type java.lang.Object cannot be resolved. It is indirectly
referenced from required .class files
解决方案:
1.右键→Build Path→Configure Build Path,检查有没有存在问题的Library
2.在Library标签中Remove掉“Unable to get system library for the
project”或其他有问题的Library
3.如果不存在android.jar,加入对应版本的android.jar(Add Librar→Android Classpath
Container或去安装路径下找android-sdk/platforms/android-X/android.jar并加入)
问题4:没有编译错误,但是运行时说有错
描述:
[2012-08-28 11:26:25 - eMenuForPhone] Dx trouble processing
"javax/net/ServerSocketFactory.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
in your application's project, when using an IDE (such as Eclipse).
If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a
core namespace, the source of which you may have taken, for
example, from a non-Android virtual machine project. This will
most
assuredly not work. At a minimum, it jeopardizes the compatibility
of your app with future versions of the platform.
It is also often of questionable legality. If you really intend to
build a core library -- which is only appropriate as part of
creating a full virtual machine distribution, as opposed to
compiling an application -- then use the "--core-library" option to
suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be prepared
for angry customers who find, for example, that your application
ceases to function once they upgrade their operating system. You
will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question
into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately lead
to pain, suffering, grief, and lamentation.
[2012-08-28 11:26:25 - eMenuForPhone] Dx 1 error; aborting
[2012-08-28 11:26:25 - eMenuForPhone] Conversion to Dalvik format
failed with error 1
解决方案:
其实质是相同的android.jar或其他包多于一个,删除多余的包使其就剩一个即可,可重做问题3解决方案中的步骤,检查是否多添加了android.jar