在两个不同的项目模块中复制库 [英] Duplicate libraries in two different project modules
问题描述
我有两个模块的项目。
我使用 SalesforceSDK 作为单独的模块包含在 SalesforceSDK 中,我有 Cordova ,它使用 okhttp
。
在第二个模块我有改进库,它使用 okhttp
太,当我尝试建立项目我得到
I have project with two modules.
I'm using SalesforceSDK which is included as separate module and inside SalesforceSDK I have Cordova which is using okhttp
.
In second module I have retrofit library which is using okhttp
too and when I try to build the project I get
重复的dex文件错误
duplicate dex files error
我试图删除 okhttp
从 SalesforceSDK 的依赖项,并包含它从我的第二个模块,但我得到
I tried to delete okhttp
dependency from SalesforceSDK and include it from my second module but I'm getting
没有找到符号错误
symbols not found error
只有包含 okhttp
不同的模块,但在我之前,我想问你是否有另一种方法来解决这个问题?
Only thing left to do is to include okhttp
as different module but before I do that I want to ask you if there is another way to fix this problem ?
我尝试了Aayushi提出的解决方案,但仍然出现错误:
I tried solution proposed by Aayushi but still I get errors :
错误:任务执行失败
' app:packageAllDebugClassesForMultiDex'。
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException:重复项目:com / squareup / okhttp / Address.class
java.util.zip.ZipException: duplicate entry: com/squareup/okhttp/Address.class
推荐答案
如果你使用android studio,使用两个库
if you are using android studio no need to delete you can use both library
只需使用
android {
defaultConfig {
...
multiDexEnabled = true
}
}
使用此语句也是必需的
dependencies
{
compile 'com.android.support:multidex:1.0.0'
}
这篇关于在两个不同的项目模块中复制库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!