Can't find lib via transitive use of sub module

前端 未结 1 572
有刺的猬
有刺的猬 2020-12-06 23:14

Android Studio 3.4.2

I has main project (app) that use module mytransport like this:

app/build.gradle

dependencies {
    annotation         


        
相关标签:
1条回答
  • 2020-12-06 23:16

    Use api instead of implementation.

    In mytransport/build.gradle:

    dependencies {
       //...
       api 'com.google.code.gson:gson:2.8.5'
    }
    

    Just an example.

    In library/build.gradle:

    dependencies {
        api project(':libraryA')
    }
    

    In app/build.gradle:

    dependencies {
        api project(':library')
    }
    

    In your app you will be able to access both library and libraryA.

    Using the implementation configuration:

    In library/build.gradle:

    dependencies {
        implementation project(':libraryA')
    }
    

    In app/build.gradle:

    dependencies {
        implementation project(':library')
    }
    

    In this case in your app you can't access the libraryA methods.

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