2017-10-04 16 views
9

Próbuję zaimplementować nową bazę danych Firestore w projekcie, który już korzysta z funkcji Firebase, w tym Realtime Database - które chcę "zaktualizować" .Nie można rozwiązać: com.google.firebase: firebase-firestore: 11.4.2

Pracuję zgodnie z przewodnikiem this, ale utknąłem przy kompilacji biblioteki Firestore.

To jest mój obecny Gradle projekt:

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 
} 

To jest mój obecny aplikacja 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' 

Projekt działa dobrze, ale gdy próbuję dodać ten wiersz:

compile 'com.google.firebase:firebase-firestore:11.4.2' 

otrzymuję komunikat:

Failed To Resolve: com.google.firebase:firebase-firestore:11.4.2 

Mam zaktualizowaną Android SDK Build-Tools, Google Play-Services i Support Repository, ale to nie pomogło.

Jak mogę to naprawić?

Odpowiedz

53

Brakuje repo google maven w bloku allprojects:

allprojects { 
    repositories { 
     jcenter() 
     maven { 
      url 'https://maven.google.com' 
     } 
    } 
} 

Jeśli używasz Gradle 4.1 lub nowszego, można uprościć go:

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

allprojects repozytoria jest co służy do lokalizowania modułów dla twojej aplikacji. W buildscript znajduje moduły tylko do stopniowania wtyczek.

Należy również upewnić się, że wszystkie moduły Firebase mają tę samą wersję.

+0

@RunLoop Jest w bieżących dokumentach. Wbudowane wideo nie zostało zaktualizowane, ale będzie. https://firebase.google.com/docs/android/setup –

+0

Nie przejmuj się, nie mogłem go zainstalować mimo to zderzył się z wersją Google Play używaną przez projekt. Aktualizacja tej wersji spowodowała inne starcia i brakujące zależności w niekończącym się bałaganie. W końcu musiałem przywrócić pierwotny stan i usunąć bazę ogniową. – RunLoop

+0

Nie powinno być problemów, jeśli wszystkie zależności Play i Firebase są w tej samej wersji. –