无法将 Firestore 添加到我的项目

Rag*_*esh 1 android firebase google-cloud-firestore

当我尝试将 firestore 添加到我的项目时。它开始向我显示依赖项错误。我尝试更改与同一版本相关的每个 Firebase 的版本。它显示无法下载 .jar 文件。有人帮我解决这个问题.我包括maven url也没有用....enter code here

我不知道如何手动添加这些 jar 文件。有没有办法解决这个问题。这样这些文件会自动下载。提前谢谢

错误:

app/build.gradle    
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>  
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>    
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>  
Unable to resolve dependency for ':app@debug/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>  
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>   
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a> 
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>   
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>   
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>  
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>    
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>  
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>  
Unable to resolve dependency for ':app@release/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>    
Unable to resolve dependency for ':app@release/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>  
Unable to resolve dependency for ':app@release/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>    
Unable to resolve dependency for ':app@release/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>    
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download grpc-core.jar (io.grpc:grpc-core:1.8.0)">Show Details</a>    
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp:okhttp:2.7.2)">Show Details</a>  
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download protobuf-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/buil`d.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download protobu`f-lite.jar (com.google.protobuf:protobuf-lite:3.0.1)">Show Details</a>  
Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)
<a href="openFile:C:/Users/Sarukesi/AndroidStudioProjects/Seminarbook/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>    
Run Code Online (Sandbox Code Playgroud)

构建.gradle:

//noinspection GradleDependency
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.sarukesi.seminarbook"
        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(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'junit:junit:4.12'
    implementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.google.firebase:firebase-firestore:17.0.1'
}

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

Ven*_*amy 6

我已将mavenCentral()添加到项目级 build.gradle 文件中。Gradle 同步成功。

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.2.0'

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

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

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)