您的位置:首页 > 其它

exclude modules when config dependencies

2015-12-16 00:00 155 查看
Plaform: Android;

Tools: Idea Intellij, Android SDK, gradle;

Sometimes there are multiple projects in a root project, and one project would refer to other projects as dependencies, if more than one projects contain the same library, it will cause "Multiple dex files define" error when building release version. "exclude" instruction would help us solve this problem.

First, check out those modules which being mulitple include:

gradlew -q :%module%:dependencies
Then edit "build.gradle" file in your application module, exlude them. In my case, I get rid of v7, v4 and annotations from a library module named "memorize":

dependencies {
compile(project(':memorize')) {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'ActiveAndroid'
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: