1

以下是我得到的错误,请帮助我!

错误:无法解析“:app@debug/compileClasspath”的依赖关系:

无法解析 com.google.firebase:firebase-core:17.2.0。

错误:无法解析“:app@debug/compileClasspath”的依赖关系:

无法解析 com.google.firebase:firebase-config:19.0.3。

错误:无法解析“:app@debug/compileClasspath”的依赖关系:

无法解析 com.google.android.gms:play-services-measurement-base:[17.2.0]。

错误:无法解析“:app@debug/compileClasspath”的依赖关系:

无法解析 com.google.android.gms:play-services-measurement-impl:[17.2.0]。

错误:无法解析“:app@debug/compileClasspath”的依赖关系:

无法解析 com.google.android.gms:play-services-measurement-sdk-api:[17.2.0]。

错误:无法解析“:app@debugAndroidTest/compileClasspath”的依赖关系:

无法解析 com.google.firebase:firebase-core:17.2.0。

错误:无法解析“:app@debugAndroidTest/compileClasspath”的依赖关系:

无法解析 com.google.firebase:firebase-config:19.0.3。

错误:无法解析“:app@debugAndroidTest/compileClasspath”的依赖关系:

无法解析 com.google.android.gms:play-services-measurement-base:[17.2.0]。

错误:无法解析“:app@debugAndroidTest/compileClasspath”的依赖关系:

无法解析 com.google.android.gms:play-services-measurement-impl:[17.2.0]。

错误:无法解析“:app@debugAndroidTest/compileClasspath”的依赖关系:无法解析com.google.android.gms:play-services-measurement-sdk-api:[17.2.0]。

错误:无法解析“:app@debugUnitTest/compileClasspath”的依赖关系:无法解析com.google.firebase:firebase-core:17.2.0。

错误:无法解析 ':app@debugUnitTest/compileClasspath' 的依赖关系:无法解析 com.google.firebase:firebase-config:19.0.3。

错误:无法解析“:app@debugUnitTest/compileClasspath”的依赖关系:无法解析com.google.android.gms:play-services-measurement-base:[17.2.0]。

错误:无法解析“:app@debugUnitTest/compileClasspath”的依赖关系:无法解析com.google.android.gms:play-services-measurement-impl:[17.2.0]。

错误:无法解析“:app@debugUnitTest/compileClasspath”的依赖关系:无法解析com.google.android.gms:play-services-measurement-sdk-api:[17.2.0]。

//app level build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.hfad.firebaselinkedin"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.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'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.firebase:firebase-core:17.2.0'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'
    implementation 'com.google.firebase:firebase-config:19.0.3'
    implementation 'com.google.firebase:firebase-auth:19.1.0'



}
apply plugin: 'com.google.gms.google-services'
//project level build.gradle

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

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

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

4

1 回答 1

1

更新

  1. 尝试“文件”->“使缓存无效/重新启动-> 无效并重新启动”
  2. 尝试清理项目根目录下的 .gradle 和 .idea 目录。

转到文件 -> 其他设置 -> 默认设置(新版本中的新项目设置) -> 构建、执行、部署 -> 构建工具 -> Gradle -> 并取消选中离线工作选项。

从这个答案

如果您使用VPN,请在同步之前关闭它或更改IP,因为某些IP被谷歌阻止,因为它们可能被用来对谷歌进行DDOS攻击

如果上述步骤对您没有帮助,请在您的项目级别build.gradle中尝试

allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }           
        maven { url "https://maven.google.com" } // Google's Maven repository - FCM
        maven {
            url 'https://dl.bintray.com/azeesoft/maven'
        }
        google()
        jcenter()
        mavenCentral()
    }
}
于 2019-10-20T03:41:24.893 回答