gpt4 book ai didi

android - 无法将 Firestore 添加到我的项目中

转载 作者:行者123 更新时间:2023-12-05 00:12:38 26 4
gpt4 key购买 nike

当我尝试将 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>

构建.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'

最佳答案

我已将 ma​​venCentral() 添加到项目级别的 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
}

关于android - 无法将 Firestore 添加到我的项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50911494/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com