首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到满足版本约束的“com.android.support:support-compat”版本

找不到满足版本约束的“com.android.support:support-compat”版本
EN

Stack Overflow用户
提问于 2019-11-19 15:41:18
回答 1查看 84关注 0票数 0

我正在使用一个内部库。因为这个库,我的android gradle构建失败了,出现了以下问题。

代码语言:javascript
复制
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'

之前它使用的是支持库:

代码语言:javascript
复制
implementation 'com.android.support:appcompat-v7:27.1.1'

现在它被移到androidx:

代码语言:javascript
复制
implementation 'androidx.appcompat:appcompat:1.0.0'

库的build.gradle文件为:

代码语言:javascript
复制
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'
}
EN

回答 1

Stack Overflow用户

发布于 2019-11-19 20:04:50

你是对的。查看该项目的代码,它似乎会检查您是否正在覆盖项目中的版本(当这些问题出现时,许多依赖项开始执行此操作)。因此,进入您的项目build.gradle (而不是app/build.gradle),您可以覆盖该库正在使用的版本:

代码语言:javascript
复制
buildscript {
    ext {
        ...
        supportLibVersion = "28.0.0"
        ...
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58928881

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档