I have an android app structured like this:
main-app/
dependencies {
compile project(':lib-A')
compile project(':lib-B')
}
lib-A/
dependencies {
compile 'Large3PLib'
compile 'Other-libs'
}
lib-B/
dependencies {
compile 'Large3PLib'
}
When I compile I am reaching the multi-dex limit, and I see that main-app, lib-A, and lib-B all have very large dex counts due to them all including 'Large3PLib'. Is there a way I can tell gradle to only include 'Large3PLib' once in order to shrink my dex count?
Notes:
You can edit lib-A
and lib-B
to mark the dependency as 'provided':
provided 'Large3PLib'
This means that it will not be included in the resulting jar or aar. But then you will have to add it to the root project:
dependencies {
compile 'Large3PLib'
compile project(':lib-A')
compile project(':lib-B')
}