eclipse Android 项目的 Gen 文件夹为空

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9299931/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 17:44:07  来源:igfitidea点击:

Gen folder is empty for Android project

androideclipse

提问by pinksharpii

I'm starting to learn Android in Eclipse. But every time I try to create a project the gen folder is empty. So I don't get the R file(or whatever else is in that folder, if anything). Clean does NOT work. There was never an R to begin with. Do I need to download something to make it generate it?

我开始在 Eclipse 中学习 Android。但是每次我尝试创建一个项目时,gen 文件夹都是空的。所以我没有得到 R 文件(或该文件夹中的任何其他文件,如果有的话)。清洁不起作用。从来没有一个 R 开始。我是否需要下载一些东西才能生成它?

回答by iglen_

had the same problem. Check in the Android sdk manager, tools and check if you have installed android sdk build-tools. had the same problem because i hadn't installed it.

有同样的问题。检查 Android sdk 管理器、工具并检查您是否已安装 android sdk build-tools。有同样的问题,因为我没有安装它。

回答by Nick

None of the solutions posted here worked for me: Clean, changing options, build errors, etc. The problem was caused by importing the Android project as a normal project, i.e. using:

此处发布的所有解决方案均不适用于我:清理、更改选项、构建错误等。问题是由于将 Android 项目作为普通项目导入,即使用:

Import > General > Existing Projects Into Workspace

instead of using

而不是使用

Import > Android > Existing Android Code Into Workspace

回答by Alesqui

I had this problem because I had two projects in the same folder and one was the library of the other. Then Eclipse built the projects in the wrong order. What I did to fix this was close the non-library project and then open it again (after the built of the library project), which made it work.

我有这个问题,因为我在同一个文件夹中有两个项目,一个是另一个的库。然后 Eclipse 以错误的顺序构建了项目。我为解决这个问题所做的是关闭非库项目,然后再次打开它(在构建库项目之后),这使它工作。

回答by Quarra

One of those

其中之一

  1. Getting rid of 'import android.R' line.
  2. Cleaning the project and then building it again.
  3. Closing project and then opening it again.
  1. 摆脱 'import android.R' 行。
  2. 清理项目,然后重新构建它。
  3. 关闭项目,然后再次打开它。

may help.

可能有帮助。

回答by hasanghaforian

May be your problem was related to incorrect target build settings.For example if you use an element in your layout that is available in greater Android targets.You can see more details here.

可能您的问题与不正确的目标构建设置有关。例如,如果您在布局中使用在更大的 Android 目标中可用的元素。您可以在此处查看更多详细信息。

回答by Subodh Garg

STRUGGLING FROM THIS BUG FROM LAST TWO DAYS. FINALLY SOLVED IT :)

从过去两天开始从这个错误中挣扎。终于解决了:)

The best way to get rid of this is to go to WINDOWS option on the tool bar -> ANDROID SDK MANAGER -> and tick TOOLS option on the top tools bar (i.e. all all android sdk tools , android sdk platform tools , android sdk build-tools.) and install.

摆脱这种情况的最佳方法是转到工具栏上的 WINDOWS 选项 -> ANDROID SDK MANAGER -> 并在顶部工具栏上勾选 TOOLS 选项(即所有 android sdk 工具、android sdk 平台工具、android sdk 构建-工具。)并安装。

After updating all these too latest versions , go to HELP and hit CHECK FOR UPDATES and install all these new version plugins.

更新所有这些最新版本后,转到帮助并点击检查更新并安装所有这些新版本插件。

Last step is to go to PROJECT option in the tool bar and uncheck the BUILT AUTOMATICALLY option and go to CLEAN and perform clean on required or on all projects.

最后一步是转到工具栏中的 PROJECT 选项并取消选中 BUILT AUTOMATICALLY 选项,然后转到 CLEAN 并对所需或所有项目执行清理。

I know this method might consume some of your net mb's but will definitely solve your problem.

我知道这种方法可能会消耗您的一些净 mb,但肯定会解决您的问题。

E.njoy...:)

享受...:)

回答by Kechit Goyal

I ran into the same problem. I had incorrectly set the path of the Android SDK. Setting the path in Windows -> Preferences -> Android did the trick for me.

我遇到了同样的问题。我错误地设置了 Android SDK 的路径。在 Windows -> Preferences -> Android 中设置路径对我有用。

回答by Pir Fahim Shah

I had the same problem. Just add these two line in your project.propertiesfile

我有同样的问题。只需在project.properties文件中添加这两行

 target=android-19
 android.library.reference.1=../appcompat_v7

回答by Cullen SUN

I happened to have the same problem, solved by "Right click on your project and then click Build Project".

我碰巧遇到了同样的问题,通过“右键单击您的项目,然后单击构建项目”解决了。

回答by AndroidEnthusiastic

Try this,

尝试这个,

Right click your project

右键单击您的项目

Select properties.

选择属性。

Select Java Build Path

选择 Java 构建路径

Click add Folder

点击添加文件夹

Select the gen folder

选择gen文件夹

Click OK.

单击确定。