异常提示:

gen already exists but is not a source folder. Convert to a source folder or rename it.
 

错误原因:

我在导入以前的项目的时候出现了这个异常,原因是.classpath文件(这个文件在eclipse中是看不到的,必须在文件浏览器中才能看到并编辑)出错,导致eclipse不能识别我的src代码文件夹,需要通过设置来指明源码所在的文件夹。
 

解决办法:

右键项目,选择Properties——Java Build Path——Source——Add Folder...
然后在弹出框中选中项目的src和gen目录,OK即可。如下图所示:
 
当然,既然是.classpath文件出错,我们也可以通过手动修改.classpath文件来修复这个错误,下面我们来看下正常的.classpath文件,如下:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <classpath>
  3. <classpathentry kind="src" path="src"/>
  4. <classpathentry kind="src" path="gen"/>
  5. <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
  6. <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  7. <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
  8. <classpathentry exported="true" kind="lib" path="libs/android-support-v4.jar"/>
  9. <classpathentry exported="true" kind="lib" path="libs/gson-2.2.4.jar"/>
  10. <classpathentry exported="true" kind="lib" path="libs/umeng_sdk.jar"/>
  11. <classpathentry kind="output" path="bin/classes"/>
  12. </classpath>
kind="src"指明源码位置
kind="con"指明当前系统环境
kind="lib"指明工程依赖的library的具体位置
kind="output"指明项目生成文件的输入位置
 
修复这个异常只需要我们手动指明src的源码位置即可。

gen already exists but is not a source folder. Convert to a source folder or rename it.的更多相关文章

  1. …gen already exists but is not a source folder. Convert to a source folder or rename it [closed]

    Right click on the project and go to "Properties" Select "Java Build Path" on th ...

  2. 导入别人的Android项目,提示 /Libs/gen already exists but is not a source folder. Convert to a source folder or rename it

    解决方法: 遇到这个问题的解决方法: 1. 右键点击工程,选择 "Properties" 2. 选择左边的 "Java Build Path" 3. 打开 &q ...

  3. gen already exists but is not a source folder. Convert to a source folder or rename it 的解决办法

    1. Right click on the project and go to "Properties" //鼠标右键点击项目,然后选中Properties   2. Select ...

  4. Eclipse.Error.gen already exists but is not a source folder.

    在Eclipse ADT来开发Android App时会遇到以下问题:"myproject/gen already exists but is not a source folder. Co ...

  5. gen already exists but is not a source folder

    遇到android项目导入出现后重复空包等错误,往往是导入的java编译级别有关,点击项目properties-> java Compiler ->修改Compiler complianc ...

  6. Convert to a source folder or rename it.

    从GitHub上恢复之前的版本  eclipse 报错: Convert to a source folder or rename it. 网上找了答案 : 找到了这个 1. 删除gen文件. 2.选 ...

  7. 把Flume的Source设置为 Spooling directory source

    把Flume的Source设置为 Spooling directory source,在设定的目录下放置需要读取的文件,一些文件在读取过程中会报错. 文件格式和报错如下: 实验一 读取汉子和“:&qu ...

  8. 在Eclipse工具里创建maven的web工程,在建立src/main/java包出现The folder is already a source folder.解决

    1. 与创建普通java工程一样,点击右键找到New菜单,在弹出的界面输入maven ---->>点击maven Project------>>点击next 2  进入下一个界 ...

  9. The folder is already a source folder

    不知为啥,创建了一个maven项目后,发现只有src/main/resources这个资源文件夹,然后,右键新建 Source Folder 时提示 “The folder is already a ...

随机推荐

  1. Python学习笔记:魔术方法详解

    准备工作 为了确保类是新型类,应该把 _metaclass_=type 入到你的模块的最开始. class NewType(Object): mor_code_here class OldType: ...

  2. android加固签名工具(源码下载)

    背景 每次android加固了都要命令行签名好麻烦,正好之前做了个图标生成工具. 所以改了改,比写批处理还要省事. 原理 其实就是用winform程序调用控制台执行命令,android签名的命令如下 ...

  3. .net截取两个字符串中间的内容

    做模拟登录时,需要截取html代码中的名字,返回的字符串内容如下 <span class="welcome">您好<span style="font-s ...

  4. [USACO2003][poj2185]Milking Grid(kmp的next的应用)

    题目:http://poj.org/problem?id=2185 题意:就是要求一个字符矩阵的最小覆盖矩阵,可以在末尾不完全重合(即在末尾只要求最小覆盖矩阵的前缀覆盖剩余的尾部就行了) 分析: 先看 ...

  5. Linq之求和,平均值,最大值,最小值

    写在前面 最近一直在弄统计的内容,和统计相关的操作,就需要用到了,而有些在数据库中操作起来非常不方便,没办法就用c#中的linq来实现了. 代码 一个例子 using System; using Sy ...

  6. 【Moqui业务逻辑翻译系列】Story of Online Retail Company 在线零售公司的故事

    h1. Story of Online Retail Company 在线零售公司的故事 Someone decides to sell a product. [Product Marketer Ma ...

  7. 每天一个linux命令(13):tail 命令

    tail 命令从指定点开始将文件写到标准输出.使用tail命令的-f选项可以方便的查阅正在改变的日志文件,tail -f filename会把filename里最尾部的内容显示在屏幕上,并且不但刷新, ...

  8. HDU 5973 Game of Taking Stones 威佐夫博弈+大数

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5973 Game of Taking Stones Time Limit: 2000/1000 MS ...

  9. (转)Java并发编程:volatile关键字解析

    转:http://www.cnblogs.com/dolphin0520/p/3920373.html Java并发编程:volatile关键字解析 volatile这个关键字可能很多朋友都听说过,或 ...

  10. Java设计模式-状态模式(State)

    核心思想就是:当对象的状态改变时,同时改变其行为,很好理解!就拿QQ来说,有几种状态,在线.隐身.忙碌等,每个状态对应不同的操作,而且你的好友也能看到你的状态,所以,状态模式就两点:1.可以通过改变状 ...