Error:(30, 18) Failed to resolve: com.android.support:design-v7:25.3.1

Error:(30, 18) Failed to resolve: com.android.support:design-v7:25.3.1

我已经添加了 "maven{url "https://maven.google.com"}" 但它不起作用 这是我的 build.gradle 文件:

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.3.3'
            classpath 'com.google.gms:google-services:3.2.0'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

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

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

这是我的另一个 build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.quizapp.conte.quizapp"
        minSdkVersion 21
        targetSdkVersion 25
        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'
    })
    compile 'com.google.firebase:firebase-core:10.2.0'
    compile 'com.google.firebase:firebase-database:10.2.0'
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    compile 'com.android.support:cardview-v7:25.3.1'
    debugCompile 'com.android.support:design-v7:25.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-core:11.8.0'
}

apply plugin: 'com.google.gms.google-services'    

对我做错了什么有什么想法吗? 我尝试了一切,但我不知道该怎么做。 我最近开始了这个项目,所以我没有修改除 build.gradle 之外的其他文件。 谢谢大家

在新的 Gradle 版本 (4.1+) 中,您必须像下面那样使用 google 存储库

allprojects {
    repositories {
        google()

       }
}

如果您使用的 Gradle 版本低于 4.1,则必须改用

allprojects {
        repositories {
         maven {
            url 'https://maven.google.com'
        // An alternative URL is 'https://dl.google.com/dl/android/maven2/'

           }
    }

Error:(30, 18) Failed to resolve: com.android.support:design-v7:25.3.1

发生这种情况是因为此依赖项不存在

使用

debugCompile 'com.android.support:design:25.3.1'

而不是

debugCompile 'com.android.support:design-v7:25.3.1'