引用多个library时经常会遇到Multiple dex files define错误,最常见的是support库多次定义,此时可用以下gradle命令来查看工程的引用树:

gradlew -q dependencies

gradlew -q <projectName>:dependencies

找出冲突的工程后exclude之。exclude语法举例:

compile ('com.aaa.bbb:ccc-v9:0.5.4') {
exclude module: 'support-v4'
}
05-17 15:40