I'm working on an Android SDK that is created from 5 modules. that each of these below modules is an android library:
-view
-IO
-Domain
-Base
-Util
And view
module has imported all the modules into it's Gradle, like below:
/*-----------------------/IO Module\-------------------*/
implementation project(path: ':io')
/*-----------------------/Base Module\-------------------*/
implementation project(path: ':base')
/*-----------------------/Domain Module\-------------------*/
implementation project(path: ':domain')
/*-----------------------/Util Module\-------------------*/
implementation project(path: ':util')
But when I wan to import my library into an application, by adding the dependency of view
module, classes of the other modules will not be recognized in the application and I have to import all the modules into my application Gradle file. like this:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
/*-----------------------/view Module\-------------------*/
implementation project(path: ':view')
/*-----------------------/Domain Module\-------------------*/
implementation project(path: ':domain')
/*-----------------------/Base Module\-------------------*/
implementation project(path: ':base')
/*-----------------------/Util Module\-------------------*/
compile project(path: ':util')
}
You want to use api
instead of implementation
in view build.gradle
file. api
is the same as deprecated compile
option but implementation
provide classes only to your module but not to modules that depend on it.