【发布时间】:2018-01-06 09:48:36
【问题描述】:
我是在 Android Studio 2.3.3 上进行 Android 应用开发的新手。我正在按照 Firebase 数据库指南连接到数据库。但是在进行同步时它失败了(见下面的错误)。很多人都在问同样的问题,但解决方案似乎对他们自己的 gradle 文件过于具体,所以我可以用它来修复我的应用程序。任何帮助将不胜感激:-)
Error:Execution failed for task ':app:processDebugGoogleServices'.
> No matching client found for package name 'com.example.lenovo.hereandthere'
build.gradle(项目:HereAndThere)
// 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(模块: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'
【问题讨论】:
-
添加google json服务文件
-
嗨,Shubham,哪些文件,在哪里以及如何?
-
developers.google.com/android/guides/…你需要一个谷歌服务json文件才能使用谷歌服务插件
-
它已经完成了。我已经上传了关于该文件的屏幕截图:“google-services.json”
-
查看文件是包名是com.example.lenovo.hereandthere
标签: android android-studio firebase firebase-realtime-database android-studio-2.3