我正在尝试在一个已经使用 Firebase 功能(包括实时数据库)的项目中实现新的 Firestore 数据库——我想“升级”它。
我正在按照本指南工作,但我在编译 Firestore 库时遇到了困难。
这是我当前的项目gradle:
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我当前的应用程序 gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.tal.wikirace"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}
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.constraint:constraint-layout:1.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.api-client:google-api-client:1.22.0'
compile'com.google.api-client:google-api-client-android:1.22.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.google.http-client:google-http-client:1.18.0-rc'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
}
apply plugin: 'com.google.gms.google-services'
该项目工作正常,但是当我尝试添加这一行时:
compile 'com.google.firebase:firebase-firestore:11.4.2'
我收到这条消息:
Failed To Resolve: com.google.firebase:firebase-firestore:11.4.2
我已经更新了Android SDK Build-Tools
,Google Play-Services
和Support Repository
,但它没有帮助。
我怎样才能解决这个问题?