【发布时间】:2015-08-13 01:10:46
【问题描述】:
--MyProject (module)
--build.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile project ':MyLib'
}
--MyLib (module)
--build.gradle
dependencies {
compile 'com.mcxiaoke.volley:library:1.0.16'
compile 'com.google.code.gson:gson:2.3.1'
}
在名为 MyLib 的库模块中,我添加了(例如)Gson 和 Volley 作为库。
我希望在MyProject 模块中使用Gson 和Volley api,而无需再次添加库作为依赖项,但我不能。当我在MyProject build.gradle 中添加Gson 或Volley 时,会导致错误:
多个dex文件定义
如何重用已添加到 MyLib 模块中的依赖项?如果这是不可能的,我该如何避免这个multiple dex files define 错误?我试过Android Studio Gradle Error: Multiple dex files define
dexOptions {
preDexLibraries = false
}
但它没有帮助。
提前致谢。
【问题讨论】:
标签: android android-studio build.gradle