开发中引入第三方 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. 查看当前mysql使用的配置文件是哪个

    my.cnf是mysql启动时加载的配置文件,一般会放在mysql的安装目录中,用户也可以放在其他目录加载.安装mysql后,系统中会有多个my.cnf文件,有些是用于测试的.使用locate my. ...

  2. git 与 ftp 共同工作

    因git主要用于版本管理,代码同步方面,因临时调试等原因,需要使用ftp上传文件. 但因为git的账户为ubuntu,ftp是虚拟账户overlord 导致文件权限不同,出现的问题主要有: 1.ftp ...

  3. Mysql ssl 连接

    在Azure创建了一个Mysql5.7服务,因为默认使用ssl连接,需要下载Azure的证书,并使用openssl生成客户端的证书.具体流程参考官方文档 大致步骤: 下载根证书, 安装openssl, ...

  4. Routemanage类方法详解

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Ref ...

  5. Redis类的源码使用

    $redis = new Redis(); //连接redis服务器 $redis->connect('127.0.0.1', '6379'); $key = "key"; ...

  6. IMDG

    将内存作为首要存储介质不是什么新鲜事儿,在对主存的使用上,内存数据网格(In Memory Data Grid,IMDG)与IMDB类似,但二者在架构上完全不同.IMDG特性可以总结为以下几点: 数据 ...

  7. xmind 8 便携版:关联文件后,双击打开文件,在当前文件夹产生configuration子文件的问题解决办法

    Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.xmind] @="XMind.Workbook.3" " ...

  8. 函数中不能对全局变量进行修改,想要修改全局变量需要在变量前面加global

    # def change_name(name):#     global school    #     school = "Mage Linux"#     print(&quo ...

  9. 如何开启 MySQL InnoDB 共享表空间和独立表空间

    修改数据库的表空间管理方式 修改my.ini文件的innodb_file_per_table的参数值即可,但是修改不能影响之前已经使用过的共享表空间和独立表空间: innodb_file_per_ta ...

  10. centos7虚拟机克隆后设置固定IP

    虚拟机centos7克隆一份出来之后,新centos7更改了固定IP,可是不生效.重启网卡时报错: network.service: control process exited, code=exit ...