Android Studio:Multiple dex files define Landroid/support/annotation/AnimRes
近期真的比較忙,一不小心博客又荒了两个月。
从今天起。决定重返csdn,多多纪录和分享。
先从一个近期被折磨的死去活来的问题。
由于升级了V4包,就一直报这个问题:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
每次都要clean一下,然后才干编译过,光这个过程就浪费了4/5分钟。出现这个问题是由于最新的v4包(compile ‘com.android.support:support-v4:22.2.1’)已经包括了annotation.jar这个包。但其它jar包里也包括这个包造成的。
而非同一时候包括了v4/V7造成的。所以一堆人说在v7包里进行例如以下设置:
compile ('com.android.support:appcompat-v7:22.2.1'){
exclude group: "com.android.support", module: "support-v4"
}
即设置v7包不包括v4,这个设了也是无用的。仅仅要确保用v4和v7 的地方版本号一致就可以。正确的解决方法有例如以下几种:
1。找到项目其它的依赖包,一定在libs里的某个jar包里,隐藏着annotation.jar包,将其删掉就ok了,此为最正统的解决方法;
2,降级v4包。由于高版本号的v4才包括annotation.jar。能够在最外面的build.grable里强制设置:
allprojects {
repositories {
jcenter()
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:22.1.0'
}
}
3,在须要v4包的地方exclude掉annotation包。注意compile要多加个括号:
compile ('com.android.support:support-v4:22.2.1'){
exclude module: 'support-annotations'
}
缺点是每一个用v4包的地方都要这么设置下。
4。在application的build.gradle里的dexOptions设置里添加一句:preDexLibraries = false就ok了:
PS:以上四种方法都能够解决这个问题,推荐正统的方法1和偷懒的方法4。
Android Studio:Multiple dex files define Landroid/support/annotation/AnimRes的更多相关文章
- Android Studio 运行出现 Multiple dex files define Landroid/support/annotation/AnimRes 解决方法
引入的工程的android-support-v4.jar版本跟自己工程的android-support-v4.jar的版本不一样
- 运行出现 Multiple dex files define Landroid/support/annotation/AnimRes 解决方法
1. 拷贝google-play-services_lib/libs/目录下的android-support-v4.jar到xxxr/libs/下 2. 工程进行如下设置:
- Android Bug:Error:com.android.dex.DexException: Multiple dex files define Landroid/support/design/widget/CoordinatorLayout$LayoutParams;
项目编译通过,运行时出现异常: Error:com.android.dex.DexException: Multiple dex files define Landroid/support/desig ...
- Android 友盟和微信的包冲突:Multiple dex files define Lcom/tencent/a/a/a/a/a;
最近App中有个需求是添加微信支付,就在微信技术官网 http://open.weixin.qq.com,查看一下文档,然后下载SDk,Demo.把SDK集成进项目. 照着微信的文档,把jar包和进来 ...
- 关于安卓百度地图SDK报错:Multiple dex files define Lcom/baidu/android/bbalbs/common/a/a;
1.找到.jar包 2.右键,用WinRAR打开 3.打开com/baidu/ 4.保留location,其他全删掉 5.这样将不会报错,可以运行了!!!
- eclipse 导入工程报错Unable to execute dex: Multiple dex files define Landroid/annotation/SuppressLint
对策: 检查libs 是否有重复加载的.
- Unable to execute dex: Multiple dex files define异常的解决办法
问题: [2016-01-06 16:47:58 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/sup ...
- Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWriter$CurrentWrite;
开发中引入第三方 aar 时编译同过,运行时出现问题: Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWr ...
- Android Studio com.android.dex.DexException: Multiple dex files define(重复引用包),androiddefine
Android Studio com.android.dex.DexException: Multiple dex files define(重复引用包),androiddefine 如果你用Andr ...
随机推荐
- EditPlus正则表达式中英文详解(附常用事例操作)
http://www.cnblogs.com/JustinYoung/articles/editplus_regular_expression.html EditPlus正则表达式中英文详解 \t T ...
- PLSQL常用配置之窗口/版面保存、SQL格式化/美化、SQL注释\去掉注释等快捷键配置、登陆历史修改配置
http://blog.csdn.net/hyeidolon/article/details/8251791 PLSQL常用配置之窗口/版面保存.SQL格式化/美化.SQL注释\去掉注释等快捷键配 ...
- Redis基本操作——List
Redis基本操作——List(原理篇) 学习过数据结构的同学,一定对链表(Linked List)十分的熟悉.相信我们自己也曾经使用过这种数据结构. 链表分为很多种:单向链表,双向链表,循环链表,块 ...
- C#基础 - C# 的 常见概念简述
在上篇文章中,你跟着我写了一个HelloWorld,本篇中,我们来谈谈一些C#程序中的小概念 1.C# 程序结构 一个 C# 程序主要包括以下部分: 命名空间声明(Namespace declarat ...
- Ubuntu 10.04 安装Qt4.8.1 源码后字体模糊的问题
Ubuntu 10.04 安装QT4.8.1 源码后字体模糊的问题. 附加解决 QT SDK 4.8.1 链接失败的问题 Ubuntu 10.04 编译QT源码后,编译程序,运行后IPA字体无法正常显 ...
- Android 中发送短信
import android.net.Uri; //调用Android系统API发送短信 Uri uri = Uri.parse("smsto:" + strSmsPhone_va ...
- linux下判断文件和目录是否存在
1.前言 工作中涉及到文件系统,有时候需要判断文件和目录是否存在.我结合APUE第四章文件和目录,总结一下如何正确判断文件和目录是否存在,方便以后查询. 2.stat系列函数 stat函数用来返回与文 ...
- python标准库介绍——17 tempfile 模块详解
==tempfile 模块== [Example 2-6 #eg-2-6] 中展示的 ``tempfile`` 模块允许你快速地创建名称唯一的临时文件供使用. ====Example 2-6. 使用 ...
- find命令之exec和xargs
exec: find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec 参数后面跟的是c ...
- spineRuntTime for cocos2dx v3,attack播完后回到idle
spineRuntTime for cocos2dx v3,attack播完后回到idle. _animationNode = spine::SkeletonAnimation::createWith ...