我正在使用一个内部库。因为这个库,我的android gradle构建失败了,出现了以下问题。
Cannot find a version of 'com.android.support:support-compat' that satisfies the version constraints:
Dependency path 'Project:library:unspecified' --> 'com.firebase:firebase-jobdispatcher:0.8.5' --> 'com.android.support:support-compat:25.0.0'
Constraint path 'Project:library:unspecified' --> 'com.android.support:support-compat:{strictly 25.0.0}' because of the following reason: debugRuntimeClasspath uses version 25.0.0
Dependency path 'Project:library:unspecified' --> 'com.github.bumptech.glide:glide:4.9.0' --> 'com.android.support:support-fragment:27.1.1' --> 'com.android.support:support-compat:27.1.1'
Dependency path 'Project:library:unspecified' --> 'com.github.bumptech.glide:glide:4.9.0' --> 'com.android.support:support-fragment:27.1.1' --> 'com.android.support:support-core-ui:27.1.1' --> 'com.android.support:support-compat:27.1.1'
Dependency path 'Project:library:unspecified' --> 'com.github.bumptech.glide:glide:4.9.0' --> 'com.android.support:support-fragment:27.1.1' --> 'com.android.support:support-core-utils:27.1.1' --> 'com.android.support:support-compat:27.1.1'
Dependency path 'Project:library:unspecified' --> 'com.github.bumptech.glide:glide:4.9.0' --> 'com.android.support:animated-vector-drawable:27.1.1' --> 'com.android.support:support-vector-drawable:27.1.1' --> 'com.android.support:support-compat:27.1.1'之前它使用的是支持库:
implementation 'com.android.support:appcompat-v7:27.1.1'现在它被移到androidx:
implementation 'androidx.appcompat:appcompat:1.0.0'库的build.gradle文件为:
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.9.1"
}
}
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "int", "DB_VERSION", "10"
}
buildTypes {
release {
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly 'com.squareup.retrofit2:retrofit:2.4.0'
compileOnly 'com.squareup.retrofit2:converter-gson:2.4.0'
compileOnly 'com.squareup.retrofit2:converter-scalars:2.4.0'
debugImplementation 'com.squareup.okhttp3:logging-interceptor:4.1.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'androidx.appcompat:appcompat:1.0.0'
compileOnly 'com.github.bumptech.glide:glide:4.9.0'
debugImplementation 'com.facebook.stetho:stetho-okhttp3:1.5.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}发布于 2019-11-19 20:04:50
你是对的。查看该项目的代码,它似乎会检查您是否正在覆盖项目中的版本(当这些问题出现时,许多依赖项开始执行此操作)。因此,进入您的项目build.gradle (而不是app/build.gradle),您可以覆盖该库正在使用的版本:
buildscript {
ext {
...
supportLibVersion = "28.0.0"
...
}
}https://stackoverflow.com/questions/58928881
复制相似问题