我将我的项目更新到最新的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.
对于从firebase codelabs教程第3步来到这里的人:请转到第4页。
Apparently, if google says You should now have the android-start project open in Android Studio. ,She means it,and not You should now have the android-start project open in Android Studio, without any build-errors .
As the instruction says there, you have to get a configuration file from firebase. i.e , create a new project in your firebase acc with name 'friendly chat and in the next page , add its package name and SHA1 KEY.
after downloading the json file,add it to your project>app folder, and Rebuild project.
我在尝试运行谷歌的Firebase分析示例应用程序时收到了这个错误:
先决条件:
下载https://github.com/firebase/quickstart-android
添加快速入门/分析到Android Studio
添加程序:
Go to https://firebase.google.com/
Click on "GO TO CONSOLE"
Click on "Add Project"
Project name: Enter: sample-app
Click "Create Project"
[Takes about 10 seconds or so...]
Click "Continue"
On the "Getting Started" page, click "Add Firebase to your Android app"
Enter package name for the android app
[The full package name appears at the top of the manifest: "com.google.firebase.quickstart.analytics"]
Click on download google-services.json
In file explorer, add google-services.json to the directory:
"quickstart/analytics/app"
[Warning: Do not rename the file, it must be: google-services.json]
Run 'app'
The sample app already contains the necessary Gradle file settings.
When adding a new project do: Tools -> Firebase -> Analytics -> Add
Event -> Connect App to Firebase.
Adding a project via Android Studio ensures that all the Gradle Dependecies are setup.
删除程序:
访问https://firebase.google.com/
点击“转到控制台”
设置—>项目设置—>删除此应用
设置—>业务群组设置—>删除业务群组
输入项目ID,按delete键
我多次添加和删除示例应用程序,没有任何明显的副作用。
对于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",
...
}
祝你好运…