我将我的项目更新到最新的Play服务类路径“com.google.gms:google-services:1.5.0-beta2”。我也在我的app.gradle文件中使用最新版本的playservices:
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
然而,当我编译时,Gradle抛出异常如下
Error:Execution failed for task ':app:processDebugGoogleServices'. > File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.
对于Cordova应用程序:
我们需要放置谷歌服务。json文件在应用程序根(我相信;当使用Cordova应用程序时,我们不进入其他文件夹/文件,如Gradle, Java文件,平台等;相反,只能通过config.xml和www文件夹来使用它们),并在config.xml中引用它,如下所示:
<platform name="android">
<!-- Add this line -->
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
注意:确保Firebase App packagename与<widget id="<packagename>"中的id属性相同…>是一样的。
为例:
<!-- config.xml of Cordova App -->
<widget id="com.appFactory.torchapp" ...>
<!--google-serivces.json from generated from Firebase console.-->
{
...
packagename: "com.appFactory.torchapp",
...
}
祝你好运…