gen 已存在但不是源文件夹

时间:2023-04-21
本文介绍了gen 已存在但不是源文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在开发我的 Android 项目,删除未使用的库后,我收到 错误:

I am developing my Android project, After I removed a unused library, I got the error:

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

在我的 Activity 代码中,来自 R.java 的所有资源都无法解析.

In my Activity code, all resources from R.java can not be resolved.

我试过了,右键单击我的项目 => Java Build Path => 在源"选项卡下,我添加了 gen/作为源.但这对解决问题没有帮助...

I tried, right click on my project => Java Build Path => under "Source" tab, I added gen/ as source. But it does not help with the problem...

为什么,如何解决这个问题?

Why, how to get rid of this problem?

----更新----

我发现,eclipse还报错项目没有project.properties文件!编辑项目属性设置一个.",但我的项目下确实有 project.properties 文件.为什么会抱怨?我已经清理了项目并修复项目属性",但没有帮助.

I found that, the eclipse also complain that "Project has no project.properties file! Edit the project properties to set one." , but I do have project.properties file under my project. Why it complains? I have cleaned the project and "fix project properties" but it does not help.

推荐答案

我遇到了同样的问题.

两个动作,第一个:

    1.右键单击项目并转到属性"
    1.Right click on the project and go to "Properties"

    2.选择左侧的Java Build Path"
    2.Select "Java Build Path" on the left

    3.打开来源"选项卡

    4.单击添加文件夹..."并检查gen"和src"
    4.Click "Add Folder..." and check "gen" and "src"

第二个:(因为之前的操作要求我删除一些东西……我不记得是什么了……)

second: (because the previous action asked me to remove something... I do not remember what it was...)

    1.右键单击项目并转到属性"
    1. Right click on the project and go to "Properties"

    2.选择左侧的Java Build Path"
    2. Select "Java Build Path" on the left

    3.打开库选项卡"

    4. 添加一个外部 JAR.添加您的 android 目录中的 Google API (android-sdkplatformsandroid-yourversion
    4. Add an external JAR. Add the Google API that is in your android directory (android-sdkplatformsandroid-yourversion

现在它对我有用!

这篇关于gen 已存在但不是源文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:如果连接了多个模拟器/设备,是否可以安装 APK 文件 下一篇:如何从 logcat 中删除旧数据?

相关文章