Android 3.0.1无法解析依赖关系

时间:2018-03-15 13:38:28

标签: android android-gradle

我想添加这些依赖项:

implementation 'com.andrognito.pinlockview:pinlockview:2.1.0'
implementation 'com.multidots:fingerprint-auth:1.0.1'

在android studio 3.0.1中使用gradle 3.0.1但是我收到以下错误:

  

无法解析':app @ debug / compileClasspath':无法解析com.multidots:fingerprint-auth:1.0.1。   无法解决':app @ debugAndroidTest / compileClasspath':无法解析com.andrognito.pinlockview:pinlockview:2.1.0。

我的build.gradle个文件是:

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

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

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        google()

    }
}

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

另一个:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.b.jacob.gallery"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:24.2.1'
    implementation 'com.android.support:design:24.2.1'
    implementation 'com.andrognito.pinlockview:pinlockview:2.1.0'
    implementation 'com.multidots:fingerprint-auth:1.0.1'
    testImplementation 'junit:junit:4.12'
}

重要的是要说这些依赖项在旧版本的android studio中解决没有任何问题。

1 个答案:

答案 0 :(得分:0)

implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:design:24.2.1'

 buildToolsVersion '26.0.2'

不能一起出现会有冲突

您的更改应该是: -

implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'

compileSdkVersion 26

注意

不要忘记在Android工作室确保离线工作 取消选中 ... 您已连接到互联网

这些是依赖关系无法解决的可能原因!!