2016-04-14 66 views
1

在我的build.gradle:文件谷歌 - services.json從模塊根目錄文件夾中缺少

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.0.0' 
     classpath 'com.google.gms:google-services:2.0.0' 
    } 
} 
apply plugin: 'com.android.application' 

android { 
    ... 
} 
apply plugin: 'com.google.gms.google-services' // This is the last line 

我試圖把google-services.json在:

+ build.gradle 
+ app 
    + google-services.json 
+ src 
    + app 
    + google-services.json 
    + main 
    + app 
     + google-service.json 

但是,這些JSON文件被google-services插件檢測到。它只是告訴File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.

我應該如何配置我的gradle腳本?我應該在哪裏放置json文件?

+0

它應該在app文件夾> ** ProjectName \ app \ google-services.json ** – Gaurav

+0

@Gaurav所以你的意思是'app'文件夾應該和'build.gradle'文件一樣嗎? – jayatubi

+0

是ProjectLevel build.gradle,您會在應用程序文件夾中找到一個build.gradle(模塊級別) – Gaurav

回答

0

google-services.json需要添加到應用程序文件夾中。

+0

正如我在我的問題中提到的。我嘗試了3個不同的地方放置應用程序文件夾,其中的json文件也一樣,但插件仍然沒有找到。 – jayatubi

+0

然後請重新創建您的google-services.json文件它可能與您的項目身份不匹配。 –