简体   繁体   English

Android项目的Gen文件夹为空

[英]Gen folder is empty for Android project

I'm starting to learn Android in Eclipse. 我开始在Eclipse中学习Android。 But every time I try to create a project the gen folder is empty. 但每次我尝试创建项目时,gen文件夹都是空的。 So I don't get the R file(or whatever else is in that folder, if anything). 所以我没有得到R文件(或该文件夹中的任何其他内容,如果有的话)。 Clean does NOT work. 清洁不起作用。 There was never an R to begin with. 从来没有一个R开始。 Do I need to download something to make it generate it? 我是否需要下载一些内容才能生成它?

had the same problem. 有同样的问题。 Check in the Android sdk manager, tools and check if you have installed android sdk build-tools. 检查Android sdk管理器,工具并检查是否安装了android sdk build-tools。 had the same problem because i hadn't installed it. 有同样的问题,因为我没有安装它。

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, ie using: 这里发布的解决方案都不适用于我:清理,更改选项,构建错误等。问题是由于将Android项目作为普通项目导入,即使用:

Import > General > Existing Projects Into Workspace

instead of using 而不是使用

Import > Android > Existing Android Code Into Workspace

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. 然后Eclipse以错误的顺序构建项目。 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. 我为解决这个问题所做的就是关闭非库项目,然后再次打开它(在构建库项目之后),这使它工作。

One of those 其中的一个

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

may help. 可能有帮助。

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

STRUGGLING FROM THIS BUG FROM LAST TWO DAYS. 最近两天从这个BUG中挣扎出来。 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 (ie 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 build -tools。)并安装。

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...:) 请享用...:)

I ran into the same problem. 我遇到了同样的问题。 I had incorrectly set the path of the Android SDK. 我错误地设置了Android SDK的路径。 Setting the path in Windows -> Preferences -> Android did the trick for me. 在Windows中设置路径 - >首选项 - > Android为我做了诀窍。

I had the same problem. 我有同样的问题。 Just add these two line in your project.properties file 只需在project.properties文件中添加这两行即可

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

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

Try this, 试试这个,

Right click your project 右键单击您的项目

Select properties. 选择属性。

Select Java Build Path 选择Java Build Path

Click add Folder 单击添加文件夹

Select the gen folder 选择gen文件夹

Click OK. 单击确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我在eclipse中清理并构建android项目时,删除bin文件夹和gen文件夹并重新生成空的gen和bin文件夹 - when i clean and build android project in eclipse it delete bin folder and gen folder and regenerate empty gen and bin folder Gen文件夹在Eclipse Android项目中消失了 - Gen folder disappearing in Eclipse Android project 关于重命名Android项目gen文件夹中的包的一些问题 - Some questions about rename a package which is in the gen folder for Android project greenDAO:我可以在android-project中使用gen文件夹吗? - greenDAO: can I use gen folder in android-project? 在Eclipse中导入现有的Android项目:没有gen源文件夹? - Import existing Android project in Eclipse: no gen source folder? Eclipse无法清除说缺少gen文件夹的Android项目 - Eclipse not able to clean a Android project saying missing gen folder 当我在eclipse中清理并构建android项目时,删除bin文件夹和gen文件夹内容 - when i clean and build android project in eclipse it delete bin folder and gen folder contents 我有一个缺少gen文件夹的现有android项目。 我如何运行这个项目? - I have an existing android project in which gen folder is missing. How can i run this project? 'R无法解析为变量' - gen文件夹为空 - 'R cannot be resolved to a variable' - gen folder is empty src文件夹在创建新的Android项目时为空 - src folder empty on creating new Android project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM