当我试图将firestore添加到我的project.it开始向我显示依赖性error.i试图更改与相同版本相关的每个firebase的版本。它显示无法下载.jar files.some一个帮助我排除这个out.i包括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 ':app@debug/compileClasspath': 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 ':app@debug/compileClasspath': 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 ':app@debug/compileClasspath': 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 ':app@debug/compileClasspath': 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 ':app@debugAndroidTest/compileClasspath': 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 ':app@debugAndroidTest/compileClasspath': 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 ':app@debugAndroidTest/compileClasspath': 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 ':app@debugAndroidTest/compileClasspath': 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 ':app@debugUnitTest/compileClasspath': 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 ':app@debugUnitTest/compileClasspath': 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 ':app@debugUnitTest/compileClasspath': 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 ':app@debugUnitTest/compileClasspath': 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 ':app@release/compileClasspath': 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 ':app@release/compileClasspath': 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 ':app@release/compileClasspath': 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 ':app@release/compileClasspath': 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 ':app@releaseUnitTest/compileClasspath': 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 ':app@releaseUnitTest/compileClasspath': 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 ':app@releaseUnitTest/compileClasspath': 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 ':app@releaseUnitTest/compileClasspath': Could not download guava.jar (com.google.guava:guava:19.0)">Show Details</a>
的build.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'
答案 0 :(得分:2)
我已将 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
}
答案 1 :(得分:0)
确保您在项目中
点击
打开首选项答案 2 :(得分:0)
我尝试将appcompat版本从28降级到15.但错误仍然相同。所以我再次将其更改为28并从build.gradle文件中删除了该maven url,因为我在某处读取了google()是否存在因此我删除了那个。之后那些依赖错误会自动解决。最后gradle成功构建。感谢@giudigior和@AlexMamo回复......