Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 运行示例GCM应用程序时出错_Android_Android Studio - Fatal编程技术网

Android 运行示例GCM应用程序时出错

Android 运行示例GCM应用程序时出错,android,android-studio,Android,Android Studio,按照谷歌网站上的说明,我从github克隆了他们的示例应用程序,并下载了Android Studio。接下来,我按照指示导入了该项目,并连接了我的Android手机。为了更好的衡量,我还让Android Studio更新它想要的任何东西 我从谷歌网站注册并下载了google-services.json文件,并按照指示将其放置在我的项目应用程序目录中。 当我跑步时,我得到: FAILURE: Build failed with an exception. * What went wrong: E

按照谷歌网站上的说明,我从github克隆了他们的示例应用程序,并下载了Android Studio。接下来,我按照指示导入了该项目,并连接了我的Android手机。为了更好的衡量,我还让Android Studio更新它想要的任何东西

我从谷歌网站注册并下载了google-services.json文件,并按照指示将其放置在我的项目应用程序目录中。

当我跑步时,我得到:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.
我对Android、Studio或Gradle一无所知,所以我只是在project dir层次结构中随意复制了google-services.json,但没有任何效果


我需要安装google-services.json的“模块根文件夹”是什么?

模块根文件夹是主项目文件夹中的
app
文件夹。
要将其粘贴到其中,首先将项目视图从
Android
更改为
project
(您将在左侧的项目文件视图上方找到此选项)。右键单击
app
文件夹并将其粘贴到那里。然后重新编译。

这是应用程序文件夹。你的应用程序build.gradle在哪里。不是你的项目,而是你的应用程序复制google-services.json文件,然后右键单击你的模块/应用程序并粘贴它。我不知道这会发生什么。在Studio中,我看到一个应用程序文件夹和一个叫做Gradle脚本的东西。在我的文件系统中,我看到了/AndroidStudioProjects/GCMDemo和subdirs应用程序、gradle和src。我把json文件的副本放在GCMDemo、app、gradle、gradle/wrapper、src/main/res中。没有骰子。好的,明白了。根据谷歌的指示,这是一个导入的项目。Studio仍然是指原始文件下载的位置,而不是AndroidStudio项目文件夹。将json文件复制到下载区域,构建良好。