您的位置:首页 > 编程语言 > Java开发

IntelliJ IDEA Export to Eclipse Android工程不能正常被Eclipse识别的解决方法

2013-04-26 21:28 591 查看
最近迷上了IntelliJ IDEA,就Android开发而言,确实要比Eclipse好用,尤其是对于Layout的布局,非常方便,但是公司大部分同事使用的还是Eclipse,这就存在一个问题——我创建的工程,怎么能让其他同事导入并开发。虽然IDEA提供了“Export to Eclipse”,但是在实际过程中还是存在问题的——Eclipse在import时,不能将这个Android工程正确识别,总是作为Java工程导入,经过反复试验,终于找到了问题——“.project”这个文件在搞鬼,具体解决方法如下:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>IDEATest</name>
<comment/>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

上面是使用IDEA创建的Android module在执行Export to Eclipse后的.project文件中的全部内容。这些内容是Eclipse工程的最基本的内容,要想让Eclipse能将其正确识别为Android工程,要进行如下修改

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>IDEATest</name>
<comment/>
<projects/>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments/>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

其中第7行至第18行,以及第25行,都是要自己添加的内容,添加完毕以后保存,再次将工程导入到Eclipse,这下就能正确识别为Android工程了。如果导入后出现了error,不要慌,可以使用Android Tools->Fix Project Properties来解决错误。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Eclipse IDEA
相关文章推荐