命令“修复项目属性”有何作用?到底是怎么做的?
“项目 -> Android 工具 -> 修复项目属性”Eclipse 命令 exaclty 的作用是什么?
我已经阅读了很多次来使用它,主要是在与 Eclipse 中的 Android R 生成问题相关的答案中,但对我来说,它就像魔法一样,我按下它,我想它修复了一些项目属性,但没有任何反应...没有视觉效果反馈,没有关于哪些项目属性已修复的信息...任何人都可以提供一些关于它到底做什么的见解?
谢谢
What does the "Project->Android Tools->Fix Project Properties" Eclipse command exaclty do?
I have read many times to use it, mostly in answers related with Android R generation problems in Eclipse, but for me it is like magic, I press on it and I suppose it Fixs some Project Properties, but nothing happens... no visual feedback, no info on which project properties has been fixed... anyone can give a bit of insight on what does it exactly do?
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过查看 ADT 源代码,特别是 FixProjectAction 并阅读源代码和注释,我们可以看到它调用:
ProjectHelper.fixProject(project) 的作用:
ProjectHelper.fixProjectNatureOrder(project) 重新排序项目性质,以便 Android 项目性质位于第一位。
AndroidNature.configureResourceManagerBuilder(project) 添加 ResourceManagerBuilder(如果尚未存在)。它将作为第一个构建器插入自身。
AndroidNature.configurePreBuilder(project) 添加 PreCompilerBuilder(如果尚未存在)。它将检查 ResourceManager 是否存在,并在之后立即插入。
AndroidNature.configureApkBuilder(project) 将 .apk 构建器添加到末尾(如果尚不存在)。
最后三个调用可确保您的项目拥有正确的构建器。当您查看 Eclipse 项目属性中的 Builders 部分时,您将看到:
By looking into ADT source code, specifically into FixProjectAction and reading source and comments we can see that it calls:
ProjectHelper.fixProject(project) does:
ProjectHelper.fixProjectNatureOrder(project) reorders project natures, so that Android project nature is first.
AndroidNature.configureResourceManagerBuilder(project) adds the ResourceManagerBuilder, if its not already there. It'll insert itself as the first builder.
AndroidNature.configurePreBuilder(project) adds the PreCompilerBuilder if its not already there. It'll check for presence of the ResourceManager and insert itself right after.
AndroidNature.configureApkBuilder(project) adds the .apk builder at the end if it's not already there.
Last three calls ensure that you have correct builder for your project. When you look at your Builders section in eclipse project properties you will see:
在项目上运行“修复项目属性”的另一个结果是,同一工作区中将该项目引用为 Android 库的任何其他项目可能具有链接到项目构建路径上的“Android 依赖项”下的 jar。
这可能会导致对同一 jar 文件的多次引用或丢失 jar 文件引用。
修复方法是从相关项目中删除这些链接,删除“Android 依赖项”并重新运行“修复项目属性”。
Another result of running "Fix Project Properties" on a project is that any other projects in the same workspace that reference the project as an Android library may have jars which get linked in under "Android Dependencies" on the project build path.
This can result in multiple references to the same jar file or missing jar file references.
The fix is to remove those links from the related projects, remove the "Android Dependency" and re-run "Fix Project Properties".