【问题标题】:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.constraintlayout:constraintLayout:1.1.3无法解析 ':app@debugUnitTest/compileClasspath' 的依赖关系:无法解析 androidx.constraintlayout:constraintLayout:1.1.3
【发布时间】:2020-07-22 10:09:15
【问题描述】:

y 构建失败并显示错误消息

无法解析 ':app@debugUnitTest/compileClasspath' 的依赖关系:无法解析 androidx.constraintlayout:constraintLayout:1.1.3

ConstraintLayout 版本:1.1.3 Gradle 插件版本:4.0.1 摇篮版本:6.1.1

我的app_build gradle如下

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.xxxxx.xxxxxxx"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintLayout:1.1.3'
    implementation 'androidx.annotation:annotation:1.1.0'
    // To use the Java-compatible @Experimental API annotation
    implementation "androidx.annotation:annotation-experimental:1.0.0"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'

    def room_version = "2.2.5"
    def lifecycle_version = "2.2.0"

    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"

    // For Lifecycle dependencies:
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"

    // optional - RxJava support for Room
    implementation "androidx.room:room-rxjava2:$room_version"

    // Test helpers
    testImplementation "androidx.room:room-testing:$room_version"

}

我的项目 build.gradle 是

buildscript {
   
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            // For Room Persistence Library
            url "https://maven.google.com"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

    标签: android-gradle-plugin android-constraintlayout


    【解决方案1】:

    jcenter()中不存在androidx.constraintlayout包

    https://jcenter.bintray.com/androidx/

    你可以做什么,

    所有项目{ 存储库{ mavenCentral() 谷歌() 中心() 行家{ // 对于房间持久性库 网址“https://maven.google.com” } } }

    【讨论】:

    • 我试过了,但我仍然收到消息“无法解析 ':app@debugUnitTest/compileClasspath' 的依赖关系 & 无法解析 ':app@debug/compileClasspath' 的依赖关系 & 无法解析':app@debugAndroidTest/compileClasspath'
    猜你喜欢
    • 1970-01-01
    • 2018-12-04
    • 1970-01-01
    • 1970-01-01
    • 2018-12-15
    • 1970-01-01
    • 2019-04-19
    • 2018-07-23
    • 2018-08-26
    相关资源
    最近更新 更多