Importing project - build path contains duplicate entry: 'src' for project

£可爱£侵袭症+ 提交于 2021-01-28 18:13:31

问题


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).

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.properties are exactly the same between initial project and the one imported into workspace

  • I got a difference between my .settings / org.eclipse.jdt.core.prefs in 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.6
    

    once 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
    

however i tried copy paste the final version of this file in my initial project, then import it again; i still get the error.


回答1:


First
Go to project Properties > Java Build Path > Select Source Tab > Remove all sources by selecting Remove button
Then restart Eclipse.
Next
Go to project Properties > Java Build Path > Select Source Tab > Add Folder button > Select gen and src
Restart Eclipse



来源:https://stackoverflow.com/questions/26755674/importing-project-build-path-contains-duplicate-entry-src-for-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!