将ADT插件创建的android项目导入到仅装有andmore插件(0.5版本)的Eclipse中是不能正常编译的,解决办法如下:
(1)修改项目根目录下.classpath文件以下内容:
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>修改成如下(也就是增加了后面三行,这样项目既可以在andmore插件下编译,也可以在ADT下编译):
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="con" path="org.eclipse.andmore.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="org.eclipse.andmore.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="org.eclipse.andmore.DEPENDENCIES"/>(2)修改项目根目录下.project文件:
将所有包含com.android.ide.eclipse.adt.*的项复制粘贴一份在其下面,并将复制粘贴项的com.android.ide.eclipse.adt修改为org.eclipse.andmore
下面是一个修改后的示例.project文件(其中ProjectName为项目名称):
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ProjectName</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.andmore.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.andmore.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>
<buildCommand>
<name>org.eclipse.andmore.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.andmore.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
这样项目既可在andmore插件下正常编译,也可在ADT插件下正常编译。如果新版本的andmore插件能自动添加上述配置就不用在手动修改了。
当使用andmore 0.5版本插件的Eclipse导入ADT创建的Android项目时,会出现编译错误。通过修改项目根目录的.classpath文件内容可以解决此问题。
2万+

被折叠的 条评论
为什么被折叠?



