Eclipse Android gen 已经存在但不是源文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9738203/
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
Eclipse Android gen already exists but is not a source folder
提问by Tawani
I am getting the following errors when I try to load an Android project in Eclipse that was working just fine last week. Any ideas?
当我尝试在 Eclipse 中加载一个上周运行良好的 Android 项目时,出现以下错误。有任何想法吗?
[2012-03-16 09:29:43 - MyProject] /MyProjectName/gen already exists but is not a source folder. Convert to a source folder or rename it
Notethat I have tried to clean the project several times, even restarted but it still gives me this errors.
请注意,我曾多次尝试清理项目,甚至重新启动,但它仍然给我这个错误。
回答by Keyhan Asghari
right click on project and go to project properties
, then goto java build path
, and then in source
tab, click on add folder
button and add gen
folder.
just src
and gen
folders should be checked there if you haven't any library projects attached.
右键单击项目并转到project properties
,然后转到java build path
,然后在source
选项卡中单击add folder
按钮并添加gen
文件夹。只是src
和gen
你没有任何附加库项目文件夹应该有检查。
回答by Ranjit
MyProject] /MyProjectName/gen already exists but is not a source folder. Convert to a source folder or rename it
This problem happens when eclipse does not able to find each linked contents in a project.
当 eclipse 无法在项目中找到每个链接的内容时,就会发生此问题。
For example:
例如:
When we import a project to eclipse from a specific folder(suppose D://NewFolder), eclipse memorized and link each content with its appropriate path (which is D://NewFolder/project_library/src in our example).
当我们从特定文件夹(假设 D://NewFolder)将项目导入到 eclipse 时,eclipse 会记住每个内容并将其链接到其适当的路径(在我们的示例中为 D://NewFolder/project_library/src)。
But if we replaced(Here D://NewFolder To E://Another_Folder) or delete the library from its specific folder(Here D://NewFolder), eclipse unable to find its(project_library) original path and give red error.
但是如果我们替换(这里 D://NewFolder 到 E://Another_Folder)或从它的特定文件夹中删除库(这里 D://NewFolder),eclipse 无法找到它的(project_library)原始路径并给出红色错误。
So when this problem happens, first we have to make sure that the imported project or library is its original folder and no changes has made to this.
所以当这个问题发生时,首先我们要确保导入的项目或库是它的原始文件夹,并且没有对此进行任何更改。
Otherwise again replace the project to its specific folder to which eclipse has linked at the time of import i.e parent folder.
否则再次将项目替换为 eclipse 在导入时链接到的特定文件夹,即父文件夹。
回答by Patrick
This happens because your .classpath file got wiped out somehow. This file contains all the information from the Java Build Path tab under Project Properties. You could add in all information manually but there's an easier way of fixing this problem.
发生这种情况是因为您的 .classpath 文件以某种方式被清除了。此文件包含来自“项目属性”下“Java 构建路径”选项卡的所有信息。您可以手动添加所有信息,但有一种更简单的方法可以解决此问题。
If you have a copy of the .classpath file on your machine, you can just copy and paste it into your project directory.
如果您的机器上有 .classpath 文件的副本,您只需将其复制并粘贴到您的项目目录中即可。
回答by Sanket Parchande
Follow these steps in Eclipse : Project -> Properties -> Select Java Build Path -> Open Source tab -> Click Add Folder and check the gen
在 Eclipse 中执行以下步骤:Project -> Properties -> Select Java Build Path -> Open Source tab -> 单击 Add Folder 并检查 gen