Gradle dependencies: compile project by relative path

前端 未结 1 926
孤街浪徒
孤街浪徒 2020-12-07 18:43

is it possible to specify a dependency in Gradle (in android studio) to another gradle project outside of the current project boundaries? For example with a relative path so

相关标签:
1条回答
  • 2020-12-07 19:39

    You can include an outside root project module using 'settings.gradle' file from your main project. It must to be a gradle project too and in the specific Android building situation, you must configure every module as an "android-library" plugin project.

    For example, in 'MyApp' project settings.gradle you can try this:

    include 'app'
    include 'dagger'
    project(':dagger').projectDir = new File('/Users/foo/workspace/stdlib/dagger')
    

    Your 'MyApp' build.gradle must reflect the need of the 'dagger' module in a relative path Gradle way:

    dependencies {
      compile project(':dagger')
    }
    

    And that's it. Repeat this step with every external module you need and you'll have a proper Gradle multi-project configuration.

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