Why does Gradle need a settings.gradle file?

后端 未结 2 1127
自闭症患者
自闭症患者 2021-02-01 13:41

I am going to convert my Android projects from Ant to Gradle.

My Eclipse workspace is very simple:

Workspace
     MyApp
     MyApp-AndroidLibrary
         


        
相关标签:
2条回答
  • 2021-02-01 14:19

    Just in case people (like myself or gladman) still have this problem and couldn't find a solution. With the current version of Gradle you can do this:

    Move the file settings.gradle to the directory My-App and replace the include by includeFlat 'MyApp-AndroidLibrary'. This should fix the problem.

    Also compare this question and see this section in the Gradle User Guide for further details.

    0 讨论(0)
  • 2021-02-01 14:37

    You are asking several different questions. Here are some hints:

    • ':MyApp-AndroidLibrary' is a logical project path, which gets mapped to a physical path based on information provided in settings.gradle.
    • A multi-project build can have an arbitrary directory structure, which is configured in settings.gradle. No need to move directories around, unless you want to.
    • Eclipse workspace and Gradle build are separate boundaries. You can have multiple builds in the same workspace.
    • When working with libraries built from source, you can either make them part of the same build, or have a separate build for them. In the latter case, you need to make sure to build the library before the app, and exchange artifacts via a Maven or Ivy repository. This could be automated using a CI server and a corporate Maven/Ivy repository. Alternatively, you could trigger the library's build manually on your machine and use a local Maven/Ivy repository.

    For more information, check out the Gradle User Guide, especially the chapter on multi-project builds.

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