为了账号安全,请及时绑定邮箱和手机立即绑定

Eclipse 导入Android工程失败 问题及解决方案汇总

标签:
Android

问题1:导入旧工程失败
描述:FileNewProjectAndroid Project from Existing Code,然后报错:Invalid project description.
解决方案1:将旧工程的路径改为非workspace的路径,然后选择FileNewProjectAndroid Project from Existing Code,在导入时,勾选Copy projects into workspace选项
解决方案2:FileNewAndroid Application Project,建立新的工程,然后删除新工程目录下所有的文件,将旧项目文件拷入,并刷新工程


问题2:AndroidManifest.xml编译不通过
描述:Android Manifest报错
解决方案:
1.检查AndroidManifest.xml,看看是不是存在版本问题:可建立一个新项目,比比新的AndroidManifest.xml在格式上与旧版的有什么区别,修改一下
2.如果在问题1中使用了第二种解决方案,检查AndroidManifest.xml中minSdkVersion和targetSdkVersion与新建项目时选择的有什么出入;然后如果没有解决问题,右键PropertiesAndroid(或者用文本编辑器打开project.properties),检查target与新建项目时选择的有什么出入


问题3:其他源代码编译不通过
描述:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
解决方案:
1.右键Build PathConfigure Build Path,检查有没有存在问题的Library
2.在Library标签中Remove掉“Unable to get system library for the project”或其他有问题的Library
3.如果不存在android.jar,加入对应版本的android.jar(Add LibrarAndroid 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

原文链接:http://www.apkbus.com/blog-664680-59164.html

点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消