You can do this by change in project.properties
Below are the steps:
Step-1. Edit/Make project.properties
in root directory and add your module as library reference after CordovaLib
:
target=android-25
android.library.reference.1=CordovaLib
android.library.reference.2=libraryModule1
android.library.reference.3=libraryModule2
Step-2. Run cordova build android
. This will make an entry in your setting.gradle
file.
//GENERATED FILE - DO NOT EDIT
include ":"
include ":CordovaLib"
include ":libraryModule1"
include ":libraryModule2"
Also your app build.gradle
will look like this:
dependencies {
----
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
debugCompile(project(path: "libraryModule1", configuration: "debug"))
releaseCompile(project(path: "libraryModule1", configuration: "release"))
debugCompile(project(path: "libraryModule2", configuration: "debug"))
releaseCompile(project(path: "libraryModule2", configuration: "release"))
----
// SUB-PROJECT DEPENDENCIES END
}