无法解决Firestore依赖性 [英] Unable to resolve Firestore dependency
问题描述
这是我的应用gradle文件
This is my app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.fitness.perspactive"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-firestore:10.2.1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
这是我的项目gradle文件
This is my project gradle file
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在我的应用程序中,我使用了Firebase实时数据库.后来,当我还尝试包括Cloud Firestore时,它没有同步.
In my application I used Firebase realtime database. Later on, when I also tried to include cloud Firestore, it isn't syncing.
当我尝试同步它时,它显示:
When I tried to sync it, it shows:
无法解决:com.google.firebase:firebase-firestore:10.2.1
Failed to resolve: com.google.firebase:firebase-firestore:10.2.1
请有人帮助我.
推荐答案
最近启动的Cloud Firestore Beta使用的正确版本是11.4.2.您可以这样声明它的依赖项:
The correct version to use for the recently launched beta of Cloud Firestore is 11.4.2. You can declare a dependency on it like so:
compile 'com.google.firebase:firebase-firestore:11.4.2'
所有Firebase组件应使用相同的版本,因此在您的情况下应该是
All Firebase components should be at the same version so, in your case that would be
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-firestore:11.4.2'
请确保您在Android SDK管理器中拥有最新的Google Repository,否则您将无法找到该版本:-).
Make sure you have the latest Google Repository in the Android SDK manager, otherwise you won't be able to find this version either :-).
使用它时,您需要升级到最新的google-services插件版本3.1.1.
While you're at it you'll need to upgrade to the latest google-services plugin, version 3.1.1.
所有这些以及更多内容都在设置页面上记录了 .值得逐步进行,并检查您的项目是否包含所有这些内容,即使您已经拥有启用Firebase的应用程序也是如此.
All of this and more are documented on the setup page. It's worth going through that step by step and checking that your project has all those things even if you have an existing Firebase-enabled app.
这篇关于无法解决Firestore依赖性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!