一,依赖冲突

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:recyclerview-v7:27.1.1 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

当我们使用android studio添加一些第三方的依赖库时,很可能会提示上面这个错误。

大致意思就是com.android.support的包版本号要保持一致,但是可能我们自己新建的项目的com.android.support包版本号要高一些,一些第三方的库的com.android.support可能没有及时更新support库,就会出现这个错误。

解决方法(同样的适用于其他的依赖冲突。)

解决方法:

在其存在冲突的module中的build.gradle文件中加入下面代码,原理就是通过遍历所有依赖,并修改指定库的版本号

其中
requested.group == 'com.android.support' com.android.support表示要修改的依赖库

details.useVersion '28.0.0' 28.0.0表示要修改的版本号

android {
compileSdkVersion 28
defaultConfig {
applicationId "cn.ktc.tvmeeting"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}

}

Android studio 常见错误修改的更多相关文章

  1. android studio常见错误

    1.Failed to import new Gradle project: Could not install Gradle distribution from'http://services.gr ...

  2. Android Studio那些错误的问题们

    本片博客会记录关于Android开发工具Android Studio出错的那些问题,包括导入项目编译失败.时间过长,莫名其妙的歇菜等等... 问题 3facets cannot be loaded.Y ...

  3. Android Studio(五):修改Android Studio项目包名

    Android Studio相关博客: Android Studio(一):介绍.安装.配置 Android Studio(二):快捷键设置.插件安装 Android Studio(三):设置Andr ...

  4. Android Studio常见对话框(普通对话框、单选对话框、多选对话框、进度条对话框、消息对话框、自定义对话框)

    Android Studio常见对话框(普通对话框.单选对话框.多选对话框.进度条对话框.消息对话框.自定义对话框) 1.普通对话框 2.单选对话框 3.多选对话框 4.进度条对话框 5.消息对话框 ...

  5. android studio 程序错误

    一.错误类型: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to 成功修改方式 File --> Setti ...

  6. Android studio 相关错误处理

    1.android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"  -->  在Activity中设置,表 ...

  7. Android开发常见错误类型一览表

    这是我的第一个博客,我会一直添加我在Android开发中遇到的错误,用来记录我开发中踩过的那些坑 ------------------------分割线------------------------ ...

  8. Android studio的错误:radle sync failed: Cause: failed to find target android-21 :

    这个错误在Android studio中经常出现,特别是你在编译不同的app的时候,到底是什么原因会导致该错误产生呢? 首先看错误信息,是找不到目标android版本-21导致的,这就很明显了,你的目 ...

  9. Android Studio配置文件路径修改

    用Android Studio进行Android开发已经成为趋势了,好的工具要用得称手也少不了好的调教,在Windows下更是如此.这里对Android Studio的相关配置文件的路径修改做下小结. ...

随机推荐

  1. css块居中

    1.已知宽高的块级元素居中: 2.未知宽高的块级元素居中:

  2. ADT打开layout目录的xml报错java.lang.NullPointerException

    原因为使用了Android Studio的绿色JRE,必须要安装安装版JDK或者JRE,绿色版JRE放在ADT目录虽然能启动ADT但是不能启动layout目录的xml

  3. time、datetime、calendar

    time 1.  Python中表示时间的方式 l  时间戳 l  格式化的时间字符串 l  元组(struct_time)共九个元素.由于Python的time模块实现主要调用C库,所以各个平台可能 ...

  4. docker基本使用

    1.启动执行一次的容器 2.启动交互式容器 -i:告诉docker守护进程始终打开交互输入 -t:给容器分配一个伪tty终端 3.查看容器 docker ps:查看正在运行的容器 docker ps ...

  5. Vue js 的生命周期(看了就懂)

    转自: https://blog.csdn.net/qq_24073885/article/details/60143856 用Vue框架,熟悉它的生命周期可以让开发更好的进行. 首先先看看官网的图, ...

  6. Scrum【转】

    转载自:https://www.cnblogs.com/l2rf/p/5783726.html 灵感来自于一段冷笑话: 一天,一头猪和一只鸡在路上散步,鸡看了一下猪说,“嗨,我们合伙开一家餐馆怎么样? ...

  7. React踩坑记

    一: Support for the experimental syntax 'classProperties' isn't currently enabled ERROR in ./src/inde ...

  8. 配置webpack.config.js中的文件

    webpack.config.js文件中,主要包括 entry:入口文件 output:出口文件 module:模块 plugins:插件 这几部分 1.基本配置 运行 webpack 这一命令可以将 ...

  9. 51nod 1630(定积分 + 期望)

    51nod1630 每个人进入竞技场后,会等概率随机匹配一个人,匹配到的人与当前胜利和失败场数无关. 胜利达到x场,或失败达到y场后,退出竞技场,根据退出时的胜利场数获得奖励,不能中途放弃. 水平高的 ...

  10. 模仿OpenStack写自己的RPC

    在openstack中使用两种通信方式,一种是Restful API,另一种是远程过程调用RPC.本片文章主要讲解openstack中RPC的使用方式,以及如何在我们自己的架构中使用RPC. 在我前面 ...