开发中引入第三方 aar 时编译同过,运行时出现问题:

Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWriter$CurrentWrite;

说白了是个 gson jar包冲突造成的,用解压缩软件查看果真如此:谢特!!!

思路一:

在 app module下的build.gradle中加入:

android{
repositories {
flatDir {
dirs 'libs'
}
} }

依赖时:

compile(name: 'barcode_scanner_library_v2.3.2.0', ext: 'aar') {
exclude group: 'com.google.gson'
}

  喜闻乐见,不管用!

思路二: 重新打包第三方的这个aar!!!

  • 【亲测有效】用解压软件解压aar文件,删除libs里重复的jar包,然后clean项目(必须操作),再次运行!

  • 新建个module项目,把解压出来aar中的有用的东西拷到新module中,再打包这个新module!

参考,二次打包(封装)AAR实用指南 https://www.jianshu.com/p/3bad128bd106

Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWriter$CurrentWrite;的更多相关文章

  1. 解决com.android.dex.DexException: Multiple dex files define Lcom/google/gson/JsonSerializer;

    我在开发Windows Azure的Mobile Service(隔天补上创建过程)的安卓客户端时,报出了com.android.dex.DexException: Multiple dex file ...

  2. Multiple dex files define Lcom/google/zxing/BarcodeFormat

    解决zxing “Could not find class 'com.goole.zxing.Result”和“Multiple dex files define”问题 时间 2014-04-24 1 ...

  3. Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/adp;

    Q:版本号不对,广告插件的版本号和项目中用的版本号不一致 A:adsplugins的build gradle里面用的版本号是10.0.1,修改app的build gradle 的google类都改成1 ...

  4. android开发学习——Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/zxing/BarcodeFormat;

    在Android Studio中,sync project没有错,但是run时会报错; http://blog.csdn.net/q568430333/article/details/50969033 ...

  5. Unable to execute dex: Multiple dex files define Lcom/gl

    [2015-04-16 17:42:04 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/gl/softphon ...

  6. Multiple dex files define Lcom/sina/sso/RemoteSSO错误解决办法

    在安卓上遇到了Multiple dex files define Lcom/sina/sso/RemoteSSO的编译错误 在网上找解决办法 搜到了解决办法是这样的 方案1:Eclipse->P ...

  7. unity3d android导出项目编译Multiple dex files define Lcom/unity3d/player/UnityPlayerActivity

    unity3d版本: 4.1.2 在导出android工程进行编译时,发现出现Multiple dex files define Lcom/unity3d/player/UnityPlayerActi ...

  8. Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/lidroid/xutils/task/TaskHandler;

    Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files defi ...

  9. Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;

    Unable to execute dex: Multiple dex files define Lcom/myapp/R$array; 我这个问题最后解决方式是,吧工程里面用同一个v4包. 很明显, ...

随机推荐

  1. 修改Docker默认的网段

    背景 一同事在研究他的安全大业,需要在AWS服务器上部署他的秘密武器,秘密武器通过Docker来部署:在部署前可以通过跳板机的内外网ssh登录上这台服务器:部署后只能通过外网ssh登录这台服务器... ...

  2. install rust

    Step 1. Trial 1 Download rustup-init.exe exec rustup-init.exe SW hangs 2. Trial 2 install rust-1.33. ...

  3. 【转】Docker简介与入门

    转自:https://segmentfault.com/a/1190000000448808 Docker是个新生的事物,概念类似虚拟化.网上关于Docker入门的东西已经很多了.不过本文探讨了Doc ...

  4. mysql用户管理及授权

    以mariadb5.5版本为例 新建用户 登录mariadb # mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Com ...

  5. 搞懂iobuffer就得先学习bytebuffer

    ByteBuffer前前后后看过好几次了,实际使用也用了一些,总觉得条理不够清晰. <程序员的思维修炼>一本书讲过,主动学习,要比单纯看资料效果来的好,所以干脆写个详细点的文章来记录一下. ...

  6. ORACLE 存储过程中保存用户自定义异常信息的一种方式

    1.创建错误日志表: create table REP_LOGS ( log_s_no NUMBER not null, log_date DATE default sysdate not null, ...

  7. html_学习地址

    源码地址: 玩安卓:https://www.wanandroid.com/project: 博客/博主地址:

  8. 【转】Python 之 元类

    原文链接: https://stackoverflow.com/questions/100003/what-is-a-metaclass-in-python      http://python.jo ...

  9. 集成学习(ensemble learning)

    集成学习,又称为“多分类器系统”(multi-classifier system).“基于委员会的学习”(committee-based learning)等.基本的想法是结合多个学习器,获得比单一学 ...

  10. 刘志梅2017710101152.《面向对象程序设计(java)》第十二周学习总结

    实验十二  图形程序设计 实验时间 2018-11-14 1.理论知识 (1) 基本AWT库采用将处理用户界面元素的任务委派给每个目标平台的本地GUI工具箱的方式,由本地GUI工具箱负责用户界面元素的 ...