gpt4 book ai didi

android - 支持库版本问题

转载 作者:行者123 更新时间:2023-12-03 06:29:21 25 4
gpt4 key购买 nike

我在升级我的应用程序时遇到困难。
我在build.gradle文件(app)中的一行之一中收到此错误(红色下划线)

implementation 'com.android.support:appcompat-v7:28.0.0'

当我将鼠标悬停在此行时的消息:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) 
Inspection info: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).

我的应用程序build.gradle如下所示:
apply plugin: 'com.android.application'

android {
compileSdkVersion 28

defaultConfig {
applicationId "com.theaskdev.sitmangalore"
minSdkVersion 21
targetSdkVersion 28
versionCode 17
multiDexEnabled true
versionName "5.7"
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
signingConfig signingConfigs.release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
productFlavors {
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "com.android.support:support-compat:28.0.0"
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-core:16.0.7'
}


apply plugin: 'com.google.gms.google-services'

我的项目build.gradle如下:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
google()
}
}

请有人解释如何解决此版本问题。这是我严重的困惑之一。 我已经检查了建议的答案。但这并不能解决我的问题。

最佳答案

app\build.gradle文件中尝试一下:

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support') {
details.useVersion "28.0.0"
} else if (details.requested.group == 'com.google.firebase') {
details.useVersion "16.2.1"
}
}
}

complette example

您还应该使用 gradle-versions-plugin获取依赖关系的最新版本。

关于android - 支持库版本问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54830500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com