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
追加GoogleのJSONサービスファイル – Killer
こんにちはShubham 、どのファイル、どこにどのように? – ronan101010101
https://developers.google.com/android/guides/google-services-plugin#adding_the_json_file googleサービスプラグイン – Killer