2017-04-13 12 views
0

アンドロイドスタジオでfirebaseを使用してアプリケーションを構築していました。 Google Playの依存関係を追加すると、私のアプリのcompat依存関係にエラーが発生しました。app compat依存関係がGoogleの依存関係を追加したときにエラーが発生しました

は、ここに私のGradleある

compile 'com.android.support:appcompat-v7:24.2.1' 


compile 'com.android.support:cardview-v7:24.2.1' 


compile 'com.android.support:recyclerview-v7:24.2.1' 


compile 'com.android.support. :constraint-layout:1.0.0-alpha9' 


compile 'com.google.firebase:firebase-database:10.0.1' 
    compile 'com.google.firebase:firebase-storage:10.0.1' 


compile 'com.google.firebase:firebase-auth:10.0.1' 


compile 'com.google.android.gms:play-services:10.0.1' 


compile 'com.firebaseui:firebase-ui-database:1.0.0' 
    compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+' 
    testCompile 'junit:junit:4.12' 
    compile 'com.google.android.gms:play-services:10.2.1' 
+0

サポートライブラリの最新バージョンを使用してください –

+0

投稿された依存関係には、 'play-services:10.0.1'と' play-services:10.2.1'の両方が含まれています。 'play-services:10.2.1'を削除してください。 –

+0

すべてのFirebaseとPlayサービスの依存関係が常にバージョンと一致していることを確認してください。最新版はこの執筆時点で10.2.1です。 –

答えて

0

まず - プロジェクトレベル build.gradleファイルでGoogleのサービスの依存関係を追加します。第二に

dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.0' 
     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 

     classpath 'com.google.gms:google-services:3.0.0' 
    } 

- アプリレベル build.gradleファイルには、あなたがそのようななどAPPCOMPAT、recyclerview、cardview、firebase、としてあなたのアプリで使用するさまざまな依存関係を追加し、その後でプレイサービスのプラグインを適用します下のコードに示すように、build.gradleファイルの下にあります。

dependencies { 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support:recyclerview-v7:25.3.1' 
    compile 'com.android.support:cardview-v7:25.3.1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 

    compile 'com.google.firebase:firebase-core:10.2.1' 
    compile 'com.google.firebase:firebase-ads:10.2.1' 
    } 

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

最終的にプロジェクトをビルドします。希望する:

関連する問題