异常提示:

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. Django1.8教程——安装Django

    本书介绍 你是不是对Django的学习感到迷茫?是不是对网上零星的教程感到绝望?是不是苦于没有可以迅速上手的实例而发愁?如果你同我一样有这些感受,那么<Django.By.Example> ...

  2. SDAutolayout图片大小根据数量变化

    只需要在自定义的PhotoContainerView中做一下判断就可以了 ) { [self setupAutoWidthFlowItems:[temp copy] withPerRowItemsCo ...

  3. 调研Android Studio开发环境的发展演变(附安装教程,多图)

    Android Studio(以下简称AS)第一次公开亮相是在2013年的谷歌I/O大会上,14年的大会上谷歌发布其试用测试版,如今AS已经历数次版本更新,功能十分强大.如(摘自百度百科Android ...

  4. 软工实践练习——使用git进行代码管理心得

    一.在Github上注册账户.其中创建organization在小组成员的账户上创建,并在其账户上创建了小组的版本库.在创建organization的过程中,参考了助教提供的博客:http://sef ...

  5. Mysql-日期转换

    一.字符串转日期 下面将讲述如何在MYSQL中把一个字符串转换成日期: 背景:rq字段信息为:20100901 1.无需转换的: SELECT * FROM tairlist_day WHERE rq ...

  6. 【转】mac os x系统上Android开发环境的搭建

    由于Google官方已经不提供Adt-Bundle下载了,主推AndroidStudio.可以从这个链接下载http://www.androiddevtools.cn.上面不光有adt-bundle, ...

  7. Java编程思想学习(十五) 注解

    注解Annotation又叫元数据,是JDK5中引入的一种以通用格式为程序提供配置信息的方式.使用注解Annotation可以使元数据写在程序源码中,使得代码看起来简洁,同时编译器也提供了对注解Ann ...

  8. [NOIP2010] 普及组

    三国游戏 题目内容不放了 由于电脑总是会拆掉最大的组合,所以玩家最多只能得到数值第二大的组合 那么找出第二大的组合就行了 #include<iostream> #include<cs ...

  9. jQuery键盘事件绑定Enter键

    <script> $(function(){ $(document).keydown(function(event){ if(event.keyCode==13){ $("#mo ...

  10. PHP 7.1 新特性一览

    可空类型主要用于参数类型声明和函数返回值声明.主要的两种形式如下:<?phpfunction answer(): ?int  {   return null; //ok}function ans ...