What does the command “Fix Project Properties” exactly do?

后端 未结 2 882
我在风中等你
我在风中等你 2021-01-03 22:07

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

相关标签:
2条回答
  • 2021-01-03 22:11

    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) does:

    • creates Java project
    • fixes classpath entries to ensure that:
      • the project does not reference any old android.zip/android.jar archive
      • the project does not use its output folder as a sourc folder
      • the project does not reference a desktop JRE
      • the project references the AndroidClasspathContainer.

    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 Resource Manager first
    • Android Pre Compiler after Resource Manager
    • Android Package Builder last
    0 讨论(0)
  • 2021-01-03 22:15

    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".

    0 讨论(0)
提交回复
热议问题