我是Android Studio 2.3.3上的Android應用開發新手。我遵循Firebase數據庫指南連接到數據庫。但是在執行同步時失敗(請參閱下面的錯誤)。很多人問我同樣的問題,但這些解決方案似乎對自己的gradle文件來說太具體,所以我可以用它來修復我的應用程序。在添加「適用插件:'com.google.gms.google-services'」for Firebase數據庫時無法同步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項目)理解(模塊:APP)
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
加入谷歌服務的JSON文件 – Killer
Shubham喜,哪些文件,哪裏以及如何? – ronan101010101
https://developers.google.com/android/guides/google-services-plugin#adding_the_json_file您需要一個谷歌服務json文件才能使用谷歌服務插件 – Killer