我正在使用内部库。由于该库,我的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'
}
答案 0 :(得分:0)
您是正确的。看到该项目的代码,似乎它会检查您是否覆盖了项目中的版本(出现这些问题时,很多依赖项开始执行此操作)。因此,进入您的项目build.gradle
(而不是app/build.gradle
),您可以覆盖库使用的版本:
buildscript {
ext {
...
supportLibVersion = "28.0.0"
...
}
}