开发中引入第三方 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. source-insight 常用操作

    [Ctrl + ] 跳转到函数.宏.变量 等定义处. [Alt  > ] 跳转到最近光标停留位置. [Alt  < ] 跳转到上次近光标停留位置. [Ctrl Shift [ ] 块位置开 ...

  2. webuploader分片上传

    屁话不多说直接上主题; webuploader,sj(WebUploader 0.1.6)网上有下 powerUpload.js 自己写的基与楼上的插件 asp.net mvc/Api 实现效果: H ...

  3. pc端布局的一点思考

    编写pc端页面需要注意些什么? 1.自适应最小屏幕,在小屏幕上样式不能错乱. 在桌面屏幕各分辨率使用比例中可以看到各桌面分辨率的使用比例,日常pc端开发我们会考虑到适配1024宽度大小的屏幕. 对于管 ...

  4. C++Primer第五版——习题答案目录

    目前正在刷<C++Primer>这本书,会在博客上记录课后习题答案,答案仅供参考. 因为水平有限,如有有误之处,希望大家不吝指教,谢谢! 目录地址 使用的系统为:win 10,编译器:VS ...

  5. Retrofit 下载网络图片 保存到本地

    private void downImage(String imagePath) { try { CommonV2Api.downloadFile(mContext, imagePath, new I ...

  6. [UE4]瞬移对象

    一.首先把Predict Projectile Path By TraceChannel的Draw Debug Type改成none,不显示射线,改成该选项并不会影响正常使用. 二.避免瞬移穿透底板 ...

  7. 二叉排序树插入C语言版 递归步骤理解

    //二叉排序树 插入 (纯C语言实现) BTNode * BSTInsert2(BTNode *bt,int key){ //为什么纯C语言实现中 if(bt==NULL){ //要写成 bt-> ...

  8. S2-052 RCE漏洞 初步分析

    PS:初步分析,只是分析了Struts2 REST插件的部分,本来菜的抠脚不敢发,但看到各大中心发的也没比我高到哪里去,索性发出来做个记事! 漏洞描述 2017年9月5日,Apache Struts发 ...

  9. MySql查询问题select from

    一开始这样不行,后来把值用单引号引起来就行了SELECT * FROM reflectmastercore WHERE name=free 就像下面这样 SELECT * FROM reflectma ...

  10. RN-进阶

    ActivityIndicator 显示一个圆形的loading的提示符 react-native-tab-navigator npm install react-native-tab-navigat ...