所有依赖性都无法解决?

时间:2018-10-14 15:27:58

标签: java android gradle

我的项目已正确构建并运行,但是由于我更新了Android Studio,因此出现了这些错误……并且未选中脱机工作。

错误

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support:multidex:1.0.3. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support:design:26.1.0. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support:cardview-v7:26.1.0. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support:recyclerview-v7:26.1.0. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support:appcompat-v7:26.1.0. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support.constraint:constraint-layout:2.0.0. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support:support-compat:26.1.0. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.github.ybq:Android-SpinKit:1.1.0. Open File Show Details


Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve > com.android.support:appcompat-v7:26.1.0. Open File Show Details


Failed to resolve: com.android.support.test:runner:1.0.2 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support.test.espresso:espresso-core:3.0.2 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support:multidex-instrumentation:1.0.2 Open File Show in Project Structure dialog


Failed to resolve: com.android.support:multidex:1.0.3 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support:design:26.1.0 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support:cardview-v7:26.1.0 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support:recyclerview-v7:26.1.0 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support:appcompat-v7:26.1.0 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support.constraint:constraint-layout:2.0.0 Show in File Show in Project Structure dialog


Failed to resolve: com.github.ybq:Android-SpinKit:1.1.0 Show in File Show in Project Structure dialog


Failed to resolve: com.android.support:support-annotations:26.1.0 Open File Show in Project Structure dialog


Failed to resolve: android.arch.lifecycle:runtime:1.0.0 Open File Show in Project Structure dialog

我的梯度

apply plugin: 'com.android.application'

android {

    compileSdkVersion 26
    buildToolsVersion '28.0.2'
    defaultConfig {
        applicationId "com.example.radon.vitrin"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        multiDexEnabled true

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
}


dependencies {
    implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
    implementation 'com.google.zxing:core:3.2.1'
    implementation files('libs/CircleImageViewmaster/gradle/wrapper/gradle-wrapper.jar')
    implementation files('libs/picasso-2.5.2(1).jar')
    implementation 'com.android.support:multidex:1.0.3'
    //noinspection GradleCompatible
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.1.0'
    //noinspection GradleCompatible
    //implementation 'com.google.android.gms:play-services:12.0.1'
    //noinspection GradleCompatible
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.android.support.constraint:constraint-layout:2.0.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support:support-compat:26.1.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
   // implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    implementation 'com.github.danylovolokh:video-player-manager:0.2.0'
    implementation 'com.zarinpal:purchase:0.0.8-beta'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
}

2 个答案:

答案 0 :(得分:1)

在您的项目.gradle(不是应用模块之一)中,您可能缺少Google存储库。这就是为什么找不到依赖项的原因。

buildscript {

    repositories {
        google() // <-- This is the line you must add
        jcenter()
    }
}

答案 1 :(得分:1)

我找到了它...就像Yuenbe所说的那样添加jcenter()和google()....然后启动一个vpn然后构建项目