Java 正在尝试将Firebase添加到Android Studio项目,但不会添加(应用程序:ProcessDebuggGoogleServices错误)
我一直试图将Firebase添加到我的android studio项目中,但在与gradle同步时,我一直遇到以下错误:Java 正在尝试将Firebase添加到Android Studio项目,但不会添加(应用程序:ProcessDebuggGoogleServices错误),java,android,firebase,google-play-services,Java,Android,Firebase,Google Play Services,我一直试图将Firebase添加到我的android studio项目中,但在与gradle同步时,我一直遇到以下错误: Error:Execution failed for task ':app:processDebugGoogleServices'. > com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonArray 以下是我的两个gradle文件: buildscript { reposit
Error:Execution failed for task ':app:processDebugGoogleServices'.
> com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonArray
以下是我的两个gradle文件:
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
及
我唯一能成功同步w/gradle的时间是当我同时删除classpath'com.google.gms:google services:3.0'
和classpath'com.google.gms:google services:3.0.0'
时,所以我假设这两个错误中的一个是错误。我已经遵循了Firebase网站上的说明,但我没有运气
快速更新:由于调试错误发生在以下行之后,实际上似乎是从google services json文件发出错误:解析json文件:C:\Users\toshiba\AndroidStudioProjects\HelpSTL\app\google services.json
谢谢你的帮助
雅各布好吧,我自己解决了这个问题;问题在于您需要从firebase获取的google-services.json文件。我刚刚重新下载并安装了该文件,现在它可以工作了 好吧,我自己解决了这个问题;问题在于您需要从firebase获取的google-services.json文件。我刚刚重新下载并安装了该文件,现在它可以工作了 @Shubhank 2.2 Preview 2首先将google plus集成到项目中,并清理和重建项目。我希望如此。我会工作的。。。您缺少google-services.json。用于在项目中集成google plus…@Shubhank 2.2 Preview 2首先在项目中集成google plus并清理和重建项目。我希望如此。我会工作的。。。您缺少google-services.json。用于项目中的google plus集成。。。。
apply plugin: 'com.android.application'
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.platin.helpstl2"
minSdkVersion 16
targetSdkVersion 23
versionCode 6
versionName "1.6"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.maps.android:android-maps-utils:0.3+'
compile 'com.google.firebase:firebase-core:9.0.2'
}
apply plugin: 'com.google.gms.google-services'