Intellij-IDEA-和-Eclipse-项目相互转换
目录
Intellij IDEA 和 Eclipse 项目相互转换
公司的默认android开发工具是eclipse,不太喜欢使用eclipse,所以早早的就换成Intellij IDEA了,今天在使用IDEA转换成eclipse项目时出现问题了。
IDEA默认是可以打开eclipse项目的,我需要把IDEA项目转换成eclipse项目后,提交到代码服务器。使用“File” -> “Export to Eclipse” 可以转换成eclipse项目,
会在项目下生成 “.classpath’和‘.project’文件。我把IDEA对应的文件(.idea目录和iml文件等)删除中,用IDEA重新打开这个项目,发现编译不通过。
查看了一下生成的’.classpath’和‘.project’文件,发现这两个文件的配置信息不正确,改成下面的后就正常了。
.project 文件对应的内容:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
需要将上面的”
.classpath对应的内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
改好以后,用IDEA打开这个eclipse项目,编译通过。