5

Tôi đang tích hợp Cơ sở dữ liệu Firebase và Xác thực vào Dự án Android của tôi. Tôi nhận được lỗi sau:Android Studio Yêu cầu "Cập nhật plugin dịch vụ google hoặc cập nhật com.google.android.gms" cho Firebase Auth và cơ sở dữ liệu

Lỗi: org.gradle.api.GradleException: Hãy sửa các xung đột phiên bản hoặc bằng cách cập nhật các phiên bản của google-dịch vụ plugin (thông tin về phiên bản mới nhất có sẵn tại https://bintray.com/android/android-tools/com.google.gms.google-services/) hoặc đang cập nhật phiên bản của com.google.android.gms thành 9.4.0.

ứng dụng tập tin build.gradle của tôi là dưới đây:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion '25.0.0' 

    defaultConfig { 
     applicationId "com.antoinecampbell.firebase.demo" 
     minSdkVersion 19 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:24.1.1' 
    compile 'com.android.support:design:24.1.1' 
    compile 'com.android.support:cardview-v7:24.1.1' 
    compile 'com.google.firebase:firebase-database:9.4.0' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.google.firebase:firebase-core:10.0.1' 
    compile 'com.google.firebase:firebase-auth:10.2.1' 
    compile 'com.android.support:appcompat-v7:24.0.0' 
    compile 'com.google.android.gms:play-services-auth:9.2.1' 

    testCompile 'junit:junit:4.12' 
} 



apply plugin: 'com.google.gms.google-services' 

Tôi biết rằng tôi đang trộn phiên bản cũ và mới của phụ thuộc, nhưng không thể tìm ra cách để giải quyết nó. Tôi sẽ cố gắng làm cho câu hỏi này hữu ích nhất có thể bằng cách chỉnh sửa sau.

Trả lời

1

Bạn cần thêm phụ thuộc vào dịch vụ của Google vào số gốcbuild.gradle của mình. Tệp này khác với tệp app/build.gradle của bạn. Thực hiện theo các Official Documentation để xem chính xác cách thức tệp build.gradleapp/build.gradle của bạn trông như thế nào.

Ngoài ra, Firebase và Dịch vụ Play cần phải có cùng số phiên bản. Vì vậy, hãy thay đổi các phụ thuộc để có ít nhất cùng một số phiên bản.

+0

tôi đã biên dịch 'com.google.firebase: căn cứ hỏa lực-cơ sở dữ liệu: 10.0.1' biên dịch 'com.google.firebase: căn cứ hỏa lực lõi: 10.0.1' biên dịch 'com.google.firebase: căn cứ hỏa lực -auth: 10.0.1 ' biên dịch' com.google.android.gms: play-services-auth: 10.0.1 ' và sự cố của tôi đã được giải quyết. –

Các vấn đề liên quan