Android studio 常见错误修改
一,依赖冲突
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 常见错误修改的更多相关文章
- android studio常见错误
1.Failed to import new Gradle project: Could not install Gradle distribution from'http://services.gr ...
- Android Studio那些错误的问题们
本片博客会记录关于Android开发工具Android Studio出错的那些问题,包括导入项目编译失败.时间过长,莫名其妙的歇菜等等... 问题 3facets cannot be loaded.Y ...
- Android Studio(五):修改Android Studio项目包名
Android Studio相关博客: Android Studio(一):介绍.安装.配置 Android Studio(二):快捷键设置.插件安装 Android Studio(三):设置Andr ...
- Android Studio常见对话框(普通对话框、单选对话框、多选对话框、进度条对话框、消息对话框、自定义对话框)
Android Studio常见对话框(普通对话框.单选对话框.多选对话框.进度条对话框.消息对话框.自定义对话框) 1.普通对话框 2.单选对话框 3.多选对话框 4.进度条对话框 5.消息对话框 ...
- android studio 程序错误
一.错误类型: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to 成功修改方式 File --> Setti ...
- Android studio 相关错误处理
1.android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" --> 在Activity中设置,表 ...
- Android开发常见错误类型一览表
这是我的第一个博客,我会一直添加我在Android开发中遇到的错误,用来记录我开发中踩过的那些坑 ------------------------分割线------------------------ ...
- Android studio的错误:radle sync failed: Cause: failed to find target android-21 :
这个错误在Android studio中经常出现,特别是你在编译不同的app的时候,到底是什么原因会导致该错误产生呢? 首先看错误信息,是找不到目标android版本-21导致的,这就很明显了,你的目 ...
- Android Studio配置文件路径修改
用Android Studio进行Android开发已经成为趋势了,好的工具要用得称手也少不了好的调教,在Windows下更是如此.这里对Android Studio的相关配置文件的路径修改做下小结. ...
随机推荐
- word 2013 标题设置多级列表
1.问题 要设置标题为多级列表,批量应用 2.解决 1选标题1 2选标题2 ...以此类推.点确定保存即可
- .Net Core实践4 web 反向代理
目标 将控制台程序改成web程序,通过IIS反向代理,处理请求 环境 win10 / .net core 2.1 / centos7 变成web程序 1.在新建的asp.net core控制台程序中添 ...
- <TCP/IP原理> (三) 底层网络技术
传输介质 局域网(LAN) 交换(Switching) 广域网(WAN) 连接设备 第三章 底层网络技术 引言 1)Interne不是一种新的网络 建立在底层网络上的网际网 底层网络——“物理网”,网 ...
- 超越村后端开发(4:API开发)
1.users相关的api开发 1.在settings中添加APPID,SECRET 2.在apps/users/views.py内: from chaoyuecun.settings import ...
- HDU - 4734 F(x) (数位dp)
For a decimal number x with n digits (A nA n-1A n-2 ... A 2A 1), we define its weight as F(x) = A n ...
- ES 常用java api
java rest client 有两种: 1.Java Low Level REST Client :用于Elasticsearch的官方低层客户端.它允许通过http与Elasticsearch集 ...
- 基于jeesite的cms系统(二):整体设计
一.菜单设计 在系统管理-菜单管理中可以设置内容管理菜单(自动生成) 注意:归属模块应属于核心模块core.如果新加的的菜单设置为内容管理模块cms,系统下次重启时会重置本次设置,具体原因不详. 二. ...
- linux_systemctl介绍
声明:本文转载自:systemd (中文简体) systemd 是 Linux 下的一款系统和服务管理器,兼容 SysV 和 LSB 的启动脚本.systemd 的特性有:支持并行化任务:同一时候採用 ...
- PHP数组函数详解大全
一.数组操作的基本函数 数组的键名和值 array_values($arr);获得数组的值 array_keys($arr);获得数组的键名 array_flip($arr);数组中的值与键名互换(如 ...
- HDU-1171 Big Event in HDU(生成函数/背包dp)
题意 给出物品种类,物品单价,每种物品的数量,尽可能把其分成价值相等的两部分. 思路 背包的思路显然是用一半总价值当作背包容量. 生成函数则是构造形如$1+x^{w[i]}+x^{2*w[i]}+.. ...