android - 所有 com.android.support 库必须使用相同的版本
问题描述
这是屏幕截图...
此行有错误
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
这一行是我根据弹出推荐添加的 2 个库。
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha3'
implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
我该如何纠正?我已经在这里尝试了很多方法,但没有一个对我有用,所以我发布了我的具体情况。谢谢!
这是我的 gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "android.cast.thought.thoughtcastandroid"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha3'
implementation 'com.android.support:support-media-compat:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
wearApp project(':wear')
implementation 'com.synnapps:carouselview:0.1.4'
implementation 'com.google.android.gms:play-services-wearable:+'
implementation project(':iskn_api-release')
}
编辑添加了gradle文件
解决方案
我已经尝试过你的 gradle 代码,我发现当你使用其他一些库时,比如下面提到的你的代码。
wearApp project(':wear')
implementation 'com.synnapps:carouselview:0.1.4'
implementation 'com.google.android.gms:play-services-wearable:+'
implementation project(':iskn_api-release')
现在发生的情况是,当这些库主要形成时,SDK 版本可能是 26 或 27,所以当我们添加这些库时,它会显示依赖冲突,因为我们没有使用相同的 SDK 版本,因此,我没有完美的解决方案可以找到,但对于这种特殊情况,我添加的另外两个依赖项删除了错误。代码如下所示。
implementation 'com.android.support:support-v4:28.0.0-alpha3'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'
如果仍然存在问题,请在您的 gradle 文件中添加 2 个依赖项,kindle 检查项目 gradle 中的类路径版本,我的是 3.1.3,如下所示。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
希望能解决问题。
推荐阅读
- neo4j - 如何在 neo4j 中的两个属性上创建唯一约束?
- reactjs - 过滤数据后反应状态不更新
- sql - SQL 查询 - 不可能在不同的行上重复总和
- javascript - 带包装器的 Webpack 条件编译
- angular - 难以理解 Chart JS 数据结构的 typescript 数组语法
- python - 使用开放式 CV 在 DICOM 图像上添加叠加层
- ios - IOS 未通过 fcm 接收 Firebase 通知,但仅在 ANDROID 上
- json - JSON中嵌套数组的输出
- javascript - 如何在 .map 中发表声明以制作?
- c# - TCP 连接中的套接字异常 10049