eclipse 导入项目 - 构建路径包含重复条目:项目的“src”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26755674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Importing project - build path contains duplicate entry: 'src' for project
提问by Theo Jouret
i'm importing a project into workspace, i get the following error:
我正在将项目导入工作区,出现以下错误:
build path contains duplicate entry: 'src' for project 'myproject'
.classpath seems to be alright:
<?xml version="1.0" encoding="UTF-8"?> <classpath> <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 excluding="..." kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="output" path="bin/classes"/> </classpath>My build target is checked in properties->android.
In my properties->java build path->source, i got both of my src and gen folders
I imported my project with File->import
the error appears in a pop-up while importing the project. I click "ok", pop-up disappears, eclipse build the project, and then the project works fine (no errors, maybe eclipse solved the problem by itself).
.classpath 似乎没问题:
<?xml version="1.0" encoding="UTF-8"?> <classpath> <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 excluding="..." kind="src" path="src"/> <classpathentry kind="src" path="gen"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="output" path="bin/classes"/> </classpath>我的构建目标在属性-> android 中检查。
在我的属性->java 构建路径->源中,我得到了我的 src 和 gen 文件夹
我使用 File->import 导入了我的项目
导入项目时,错误出现在弹出窗口中。我单击“确定”,弹出窗口消失,eclipse 构建项目,然后项目工作正常(没有错误,也许 eclipse 自己解决了问题)。
i could just ignore the error and work on my project, but i'd like to understand what's wrong with the initial project i'm importing
我可以忽略错误并处理我的项目,但我想了解我正在导入的初始项目有什么问题
.classpath, .project, AndroidManifest.xml, project.propertiesare exactly the same between initial project and the one imported into workspace
I got a difference between my .settings / org.eclipse.jdt.core.prefsin my initial project and the one imported inside my workspace:
initial project:
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.source=1.6once imported, inside workspace
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6
.classpath, .project, AndroidManifest.xml, project.properties在初始项目和导入工作区的项目之间完全相同
我的初始项目中的.settings / org.eclipse.jdt.core.prefs与导入到我的工作区中的不同:
初始项目:
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.source=1.6导入后,在工作区内
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6
however i tried copy paste the final version of this file in my initial project, then import it again; i still get the error.
但是我尝试将这个文件的最终版本复制粘贴到我的初始项目中,然后再次导入;我仍然收到错误。
回答by vovahost
First
Go to project Properties> Java Build Path> Select SourceTab > Remove all sources by selecting Removebutton
Then restart Eclipse.
Next
Go to project Properties> Java Build Path> Select SourceTab > Add Folderbutton > Select genand src
Restart Eclipse
首先
转到项目属性> Java 构建路径> 选择源选项卡> 通过选择删除按钮删除所有源
然后重新启动 Eclipse。
下一步
转到项目属性> Java 构建路径> 选择源选项卡 >添加文件夹按钮 > 选择gen和src
重新启动 Eclipse

