0

Androidスタジオ2.3.3のAndroidアプリ開発には初めてです。私はDBに接続するFirebaseデータベースガイドラインに従っています。しかし、同期を実行すると失敗します(以下のエラーを参照)。多くの人が同じ質問をしていますが、解決策は自分のgradleファイルにはあま​​りにも固有のようですので、私はそれを使ってアプリケーションを修正することができました。Firebaseデータベースに「apply plugin: 'com.google.gms.google-services'」を追加すると、gradleを同期できません

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 
     classpath 'com.google.gms:google-services:3.1.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

build.gradle:任意のヘルプは

Error:Execution failed for task ':app:processDebugGoogleServices'. 
> No matching client found for package name 'com.example.lenovo.hereandthere' 

build.gradle(HereAndThereプロジェクト):-)理解されるであろう(モジュール:アプリ)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 
    defaultConfig { 
     applicationId "com.example.lenovo.hereandthere" 
     minSdkVersion 19 
     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(dir: 'libs', include: ['*.jar']) 
    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.+' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
} 

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

注: enter image description here

+0

追加GoogleのJSONサービスファイル – Killer

+0

こんにちはShubham 、どのファイル、どこにどのように? – ronan101010101

+0

https://developers.google.com/android/guides/google-services-plugin#adding_the_json_file googleサービスプラグイン – Killer

答えて

0

パッケージ名に一致するクライアントが見つかりません問題は、以下の理由の一つで発生する可能性があります「com.example.lenovo.hereandthere」

  1. 何のGoogleのサービス.jsonファイルが存在しないが
  2. やGoogleサービス.json存在し、ファイルは存在しますが、間違った場所に置かれます。 check out this
  3. またはパッケージ名がGoogleのサービス.jsonで述べたものとは異なる(人々は通常ことを行いませんが、残念ながらこの はあなたのケースである。)
+0

はい、ありがとうございます!私は正しいパッケージ名で新しいプロジェクトを作り直しました。私は今データベースを読み書きできます。そんな痛みでした。 – ronan101010101

関連する問題