Gradle configuration with multi-module android library

前端 未结 1 1047
长情又很酷
长情又很酷 2021-02-09 05:32

Back history

I have this android library aar that devs can use normally with

compile \'com.companyname.sdk:android-sdk:2.x\         


        
相关标签:
1条回答
  • 2021-02-09 06:13

    You should do something like this:

    root:
      |- test_app (apk just for testing, not deployed anywhere)
      |- core 
      |- extra_1
      |- extra_2
      |- extra_ ... etc
      |- android-sdk
    

    In core/build.gradle:

    apply plugin: 'com.android.library'
    //...
    

    In extra1/build.gradle:

    apply plugin: 'com.android.library'
    //...
    dependencies {
       compile project(':core')
    }
    

    In android-sdk/build.gradle:

    apply plugin: 'com.android.library'
    //...
    dependencies {
       compile project(':core')
       compile project(':extra')
    }
    
    0 讨论(0)
提交回复
热议问题