exclude modules when config dependencies
博客专区 > june 的博客 > 博客详情
exclude modules when config dependencies
june 发表于2年前
exclude modules when config dependencies
  • 发表于 2年前
  • 阅读 7
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

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'
    }

共有 人打赏支持
粉丝 0
博文 80
码字总数 5323
×
june
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: