运行时报错

Duplicate class com.google.gson.DefaultDateTypeAdapter found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.ExclusionStrategy found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldAttributes found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldNamingPolicy found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldNamingPolicy$1 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldNamingPolicy$2 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldNamingPolicy$3 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldNamingPolicy$4 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldNamingPolicy$5 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.FieldNamingStrategy found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.Gson found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.Gson$1 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.Gson$2 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.Gson$3 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.Gson$4 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)
Duplicate class com.google.gson.Gson$5 found in modules gson-2.7.jar (com.google.code.gson:gson:2.7) and xiaohaizi-yst-release-runtime.jar (xiaohaizi-yst-release.aar)

这个报错中指出是哪个库冲突,但是该库也是必要的,不能删除。在实际测试中发现具体出现冲突的库如下

implementation 'com.squareup.retrofit2:converter-gson:2.1.0'

以及lib包下的。去掉其一就可以运行成功。

但是因为需求都不能移除,最终处理结果如下

implementation 'com.squareup.retrofit2:converter-gson:2.1.0'

改为
compile ('com.squareup.retrofit2:converter-gson:2.1.0'){exclude group : 'com.google.code.gson'
}

问轻松解决

gson库冲突 com.google.code.gson:gson:2.7相关推荐

  1. 基于流式输入输出 使用Java借助GSON库 实现对大型asc文件的读入解析 并输出为JSON文件

    基于流式输入输出 使用Java借助GSON库 实现对大型asc文件的读入解析 并输出为JSON文件 致谢 1 为什么要使用流式输入输出(使用情景) 2 目标.主要思路及相关方法 2.1 目标 2.2 ...

  2. Android 天气预报【解析XML / Json文件(2种方式:手动解析、Gson库解析)】

    源码 [工程文件]:https://gitee.com/lwx001/Weather XML : activity_main.xml : <RelativeLayout xmlns:androi ...

  3. Oracle 使用GSON库解析复杂json串

    在前文中讲到了如何使用JSON标准库解析json串,参考: Oracle解析复杂json的方法(转) 现补充一篇使用GSON库在Oracle中解析复杂json的方法. GSON串的使用教程参考官方文档 ...

  4. android gson工具包,Android Study 之 彻底解决 Gson解析 异常

    > LZ-Say:大风呼呼的刮,就好像妖精要来的前奏一样~ > > 前言 开发过程中,App常用的接收参数的时候,几乎大部分都是以json格式为主,那么有关解析json的方式有很多, ...

  5. google code review系列6 - 处理code review中的pushback(完结篇​)

    接上篇:google code review系列5 - 如何编写code review评论.本篇是code review的完结篇,pushback可以解释成对code review出来的问题的拖延.推 ...

  6. ios 静态库冲突的解决办法

    参考:http://www.cnblogs.com/machao/p/5288460.html ios 静态库冲突的解决办法 最近在做一个 iOS 的 cocos2d-x 项目接入新浪微博 SDK 的 ...

  7. jQuery避免$符和其他JS库冲突的方法对比

    jQuery避免$符和其他JS库冲突的方法对比 1.如果jquery库在第三方库之后引用.这个时候jquery库会占用$. 解决办法:剔除$符号的使用权. <script type=" ...

  8. GitHub, Google Code, and other

    http://antkillerfarm.github.io/ GitHub 2014.12 自从最近google code日益难以访问以来,我就一直在思考着替代的方案.然后在大徐的blog的指引之下 ...

  9. 一个下载Google code源码的 绿色、迷你工具 MiniSVN v1.0

    一个下载Google code源码的 绿色.迷你工具 MiniSVN v1.0 想下载Google code中的源码 不需要装各种软件,只需要一个小工具即可! 如何使用? 访问一个谷歌开源项目网站,比 ...

最新文章

  1. 如何寻找蛋白和蛋白,基因和基因之间的相互作用---string
  2. 阿里巴巴宣布成立人工智能治理与可持续发展实验室
  3. springMVC3学习(二)--ModelAndView对象
  4. Debian部署postgresql并允许远程连接
  5. Perl 正则表达式 html,使用正则表达式验证表单中的HTML字段使用perl
  6. 【CV】使用计算机视觉算法检测钢板中的焊接缺陷
  7. OpenCV学习笔记——判断两张图的相似度
  8. Edge 浏览器被爆存在 XSS 绕过漏洞
  9. sql server使用杂记
  10. 本地上传文件到FastDFS命令上传报错:ERROR - file: connection_pool.c, line: 142, connect to server 192.168.0.197:221
  11. DIV块中 元素垂直居中
  12. Flink流式计算在节省资源方面的简单分析
  13. timthumb+php,timthumb.php生成缩略图参数详解
  14. Coverity 代码静态安全扫描工具 : 认识Coverity
  15. 《人人都是产品经理》读书笔记
  16. BASH脚本基础:使用md5sum命令生成消息摘要指纹与验证
  17. PHP本地文件包含漏洞环境搭建与利用
  18. 数字化制造的世界最高水平,看灯塔工厂如何推进数字化
  19. java弹跳小球程序_用java实现跳动的小球示例代码
  20. Linux上配置nginx访问图片报404解决方案

热门文章

  1. 第一章 电商秒杀商品回顾
  2. 分布式系统中 Unique ID 的生成方法
  3. JavaScript通过键盘让div盒子上下左右的移动
  4. 几张图就能轻松掌握Git常用命令和原理
  5. [Django个人网站开发]·编写你的第一个 Django 应用-第 1 部分
  6. 使用IPMI安装操作系统(ISO文件安装)
  7. 6个帮助你写出漂亮JavaScript代码的实用技巧
  8. Appium Server源码分析之作为Bootstrap客户端
  9. 美国商学院申请条件知多少,雅思专家来解惑
  10. 通俗的解释什么是Docker,一文搞懂