2016-06-08 104 views
1

我一直在尝试将Firebase添加到我的android studio项目中,但是当我同步w/gradle时,我一直遇到以下错误:尝试将Firebase添加到Android Studio项目,但它不会添加(app:processDebugGoogleServices错误)

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() 

    } 
} 

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' 

我可以成功同步w/gradle的唯一时间是当我同时删除classpath 'com.google.gms:google-services:3.0.0'classpath 'com.google.gms:google-services:3.0.0',所以我假设这两个错误之一是。我已经按照Firebase网站上的说明操作,但我没有运气。

快速更新:它实际上好像错误是现在可以从谷歌的服务JSON文件发出,因为这条线后出现的调试错误:Parsing json file: C:\Users\toshiba\AndroidStudioProjects\HelpSTL\app\google-services.json

感谢您的帮助,

雅各

+0

演播室版本? – Shubhank

+0

@Shubhank 2.2 Preview 2 –

+0

首先您将Google plus集成到您的项目中,并清理并重建您的项目。我希望。我会工作......你想念google-services.json。这是用于谷歌加在项目中的集成.... –

回答

0

好吧,我真的自己解决了这个问题;问题出在您需要从firebase获取的google-services.json文件。我刚刚redownloaded并安装该文件,现在它工作!

相关问题