Android Studio 3.2.1:不可修复的渐变错误

Android Studio 3.2.1:不可修复的渐变错误,android,android-studio,Android,Android Studio,我试图为我的应用程序创建一个消息传递功能。但是,我不再需要创建此功能,也不知道需要删除哪些代码,以便不再发生这些错误: 梯度同步失败:无法解析外部依赖关系 gms:googleservices:4.2.0,因为没有存储库 定义所需人员:项目:有关更多详细信息,请参阅IDE日志(帮助 |显示日志(504毫秒) 这是我的gradle文件: apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-serv

我试图为我的应用程序创建一个消息传递功能。但是,我不再需要创建此功能,也不知道需要删除哪些代码,以便不再发生这些错误:

梯度同步失败:无法解析外部依赖关系 gms:googleservices:4.2.0,因为没有存储库 定义所需人员:项目:有关更多详细信息,请参阅IDE日志(帮助 |显示日志(504毫秒)

这是我的gradle文件:

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



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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}

dependencies {
    implementation ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar'){
        transitive=true
    }
}


repositories {
    jcenter()
}

添加
google
repo

repositories {
        jcenter()
        google()
    }

添加
google
repo

repositories {
        jcenter()
        google()
    }
添加
google()
作为所有您的

buildscript {
    repositories {
        google() // must be the first one!!!!
        jcenter()
    }
}

请参见此处

添加
google()
作为所有您的

buildscript {
    repositories {
        google() // must be the first one!!!!
        jcenter()
    }
}

看这里

无法解析外部依赖关系 gms:googleservices:4.2.0

查找项目根
build.gradle
文件

buildscript {

   repositories {             // add this tag, if you don't have with repo
      google()
      jcenter()
   }

   dependencies {
      classpath 'com.android.tools.build:gradle:3.2.1'
      classpath 'com.google.gms:google-services:4.2.0'
   }
}
希望您有正确的网络连接,并确保您没有在全局渐变设置中选中脱机工作

无法解析外部依赖关系 gms:googleservices:4.2.0

查找项目根
build.gradle
文件

buildscript {

   repositories {             // add this tag, if you don't have with repo
      google()
      jcenter()
   }

   dependencies {
      classpath 'com.android.tools.build:gradle:3.2.1'
      classpath 'com.google.gms:google-services:4.2.0'
   }
}

希望您有正确的网络连接,并确保没有在全局渐变设置中检查脱机工作。

错误在哪里?我们必须猜测错误?@ZaidMirza Gradle sync失败:无法解析外部依赖项com.google.gms:google services:4.2.0,因为未定义存储库。项目要求:查阅IDE日志了解更多详细信息(帮助|显示日志)(504 ms)错误在哪里?我们必须猜测错误?@ZaidMirza Gradle sync失败:无法解析外部依赖项com.google.gms:google services:4.2.0,因为未定义存储库。所需人员:项目:有关更多详细信息,请查阅IDE日志(帮助|显示日志)(504 ms),我做到了。但现在在Android studio中,它说要更新索引,只是保持缓冲。这需要时间。。。它将下载其中的一些。我仍然收到相同的错误,说存储库没有定义。我做到了。但现在在Android studio中,它说要更新索引,只是保持缓冲。这需要时间。。。它将下载其中的一些。我仍然收到相同的错误,说存储库没有定义。