在Eclipse干净暂时摧毁Android项目并显示错误消息:缺少必需的源文件夹:“根” [英] Clean in Eclipse temporarily destroys Android project with error message: missing required source folder: 'gen'

查看:192
本文介绍了在Eclipse干净暂时摧毁Android项目并显示错误消息:缺少必需的源文件夹:“根”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了在Eclipse中的Andr​​oid项目一个恼人的问题。我所有的其他Android项目好(目前)。每当我执行干净(菜单:项目 - >清洁...)项目提供了一个错误,我不能编译/运行的应用程序。该错误是:

I am experiencing an annoying problem with an Android project in Eclipse. All my other Android projects are okey (at the moment). Whenever I perform a clean (Menu:Project->Clean...) the project gives an error and I can't compile/run the app. The error is:

项目项目名称缺少必需的源文件夹:根

当我编辑一些code中的问题消失,直到我再次执行干净。在根文件夹我还可以右键单击并删除它。 Eclipse将重新创建根文件夹,问题消失了,直到我执行干净。这不是一个搅局者,但它实在是烦人,因为我有时在我运行应用程序做一次清洁。

As soon as I edit some code the problem disappears until I perform a clean again. I can also right-click on the gen-folder and delete it. Eclipse will recreate the gen-folder and the problem disappears until I perform a clean. This is not a showstopper but it is really annoying since I sometimes have to do a clean before I run the app.

我使用下列内容:结果
操作系统:Ubuntu的10.04(Linux的CYLON 2.6.32-24-通用)结果
月蚀:太阳神发布(建立ID:20100617-1415)结果
Android的开发工具:0.9.7.v201005071157-36220(最新截至今日)

I'm using the following:
OS: Ubuntu 10.04 (Linux CYLON 2.6.32-24-generic)
Eclipse: Helios Release (Build id: 20100617-1415)
Android dev tools: 0.9.7.v201005071157-36220 (the latest as of today)

推荐答案

我们终于追踪关于这个bug的最后一个问题。

We have finally tracked the last problem regarding this bug.

以前总是删除这是错的根文件夹中的清洁行动。
这是固定的ADT 8或9,我不记得了。

The "clean" action used to always delete the "gen" folder which was wrong. This was fixed in ADT 8 or 9, I can't remember.

然而,如果根的文件夹被标记为衍生它仍然被删除而导致的误差。

However, if the "gen" folder is marked as derived it still gets deleted which leads to the error.

在运行新建项目向导中,根文件夹创建正常,没有派生标志,所以这是好的。

When the "New Project Wizard" is run, the gen folder is created normally, without the "derived" flag, so this is fine.

下面的情形却坏了:


  • 手动删除根,或

  • 检查源$ C ​​$ C的仓库(Git / SVN / ...),不要把根的文件夹在那里,然后做一个检查出另一台计算机上。

  • delete manually gen, or
  • check in the source code in a repository (git/svn/...) and don't put the "gen" folder in there, then do a check out on another computer.

这将导致ADT生成过程中自动重新创建根文件夹,这时候启用派生的旗帜,这将触发干净的错误的行为。

This leads to ADT recreating automatically the "gen" folder during build, this time enabling the "derived" flag, which will trigger the wrong behavior on "clean".

临时解决方案是:


  • 右键点击根

  • 选择属性

  • 取消选中派生

只要在根文件夹不被删除,你就可以清理项目无副作用。

as long as the "gen" folder doesn't get deleted you'll be able to clean your project without side effect.

我刚刚检查了修复程序:
- 从来没有标记的文件夹衍生
- 在清洁,首先从根删除派生标志,以便它不会在旧项目的情况下删除。
补丁是可见的: https://review.source.android.com/#change,22410

I just checked in a fix to: - never mark the folder as "derived" - during clean, first remove the "derived" flag from "gen" so that it doesn't get deleted in the case of older projects. Patch is visible at: https://review.source.android.com/#change,22410

这篇关于在Eclipse干净暂时摧毁Android项目并显示错误消息:缺少必需的源文件夹:“根”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆