“修复项目属性"命令是什么意思?究竟是做什么的?
Project->Android Tools->Fix Project Properties"Eclipse命令exaclty有什么作用?
What does the "Project->Android Tools->Fix Project Properties" Eclipse command exaclty do?
我已经阅读了很多次使用它,主要是在与 Eclipse 中的 Android R 生成问题相关的答案中,但对我来说它就像魔术一样,我按下它,我想它修复了一些项目属性,但没有任何反应... 没有视觉反馈,没有关于修复了哪些项目属性的信息......任何人都可以对它究竟做了什么提供一些见解?
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?
谢谢
推荐答案
通过查看 ADT 源代码,特别是 FixProjectAction 并阅读我们的源代码和评论可以看到它调用了:
By looking into ADT source code, specifically into FixProjectAction and reading source and comments we can see that it calls:
ProjectHelper.fixProject(project);
ProjectHelper.fixProjectNatureOrder(project);
AndroidNature.configureResourceManagerBuilder(project);
AndroidNature.configurePreBuilder(project);
AndroidNature.configureApkBuilder(project);
ProjectHelper.fixProject(project) 做:
- 创建 Java 项目
- 修复类路径条目以确保:
- 该项目未引用任何旧的 android.zip/android.jar 存档
- 项目不使用其输出文件夹作为源文件夹
- 该项目未引用桌面 JRE
- 项目引用了 AndroidClasspathContainer.
ProjectHelper.fixProjectNatureOrder(project) 重新排序项目性质,使Android项目性质优先.
ProjectHelper.fixProjectNatureOrder(project) reorders project natures, so that Android project nature is first.
AndroidNature.configureResourceManagerBuilder(project) 添加 ResourceManagerBuilder,如果它不存在的话.它将自己作为第一个构建器插入.
AndroidNature.configureResourceManagerBuilder(project) adds the ResourceManagerBuilder, if its not already there. It'll insert itself as the first builder.
AndroidNature.configurePreBuilder(project) 如果 PreCompilerBuilder 不存在,则添加它.它会检查 ResourceManager 的存在并在之后立即插入.
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) 如果 .apk 构建器不存在,则在末尾添加.
AndroidNature.configureApkBuilder(project) adds the .apk builder at the end if it's not already there.
最后三个调用可确保您的项目具有正确的构建器.当您查看 Eclipse 项目属性中的 Builders 部分时,您会看到:
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 预编译器
- Android Package Builder 最后
相关文章