異常提示:
gen already exists but is not a source folder. Convert to a source folder or rename it.
錯(cuò)誤原因:
我在導(dǎo)入以前的項(xiàng)目的時(shí)候出現(xiàn)了這個(gè)異常,原因是.classpath文件(這個(gè)文件在eclipse中是看不到的,必須在文件瀏覽器中才能看到并編輯)出錯(cuò),導(dǎo)致eclipse不能識(shí)別我的src代碼文件夾,需要通過(guò)設(shè)置來(lái)指明源碼所在的文件夾。
解決辦法:
右鍵項(xiàng)目,選擇Properties——Java Build Path——Source——Add Folder...
然后在彈出框中選中項(xiàng)目的src和gen目錄,OK即可。如下圖所示:
當(dāng)然,既然是.classpath文件出錯(cuò),我們也可以通過(guò)手動(dòng)修改.classpath文件來(lái)修復(fù)這個(gè)錯(cuò)誤,下面我們來(lái)看下正常的.classpath文件,如下:
- <?xml version="1.0" encoding="UTF-8"?>
- <classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="gen"/>
- <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
- <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 exported="true" kind="lib" path="libs/android-support-v4.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/gson-2.2.4.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/umeng_sdk.jar"/>
- <classpathentry kind="output" path="bin/classes"/>
- </classpath>
kind="src"指明源碼位置
kind="con"指明當(dāng)前系統(tǒng)環(huán)境
kind="lib"指明工程依賴的library的具體位置
kind="output"指明項(xiàng)目生成文件的輸入位置
修復(fù)這個(gè)異常只需要我們手動(dòng)指明src的源碼位置即可。