在两个不同的项目模块中复制库 [英] Duplicate libraries in two different project modules

查看:226
本文介绍了在两个不同的项目模块中复制库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个模块的项目。
我使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆