11

I have downloaded the Google services sample from here and when I try to run it following the steps about the JSON, then an error pops out. The problem is that the console and the log, shows nothing about this error.

It looks like this. enter image description here

I have no idea what am I doing wrong but, after this, I can't try to run it again, because the Run button is disabled.

Any idea to solve this?

UPDATE: This is the log in the Gradle Console:

Configuration on demand is an incubating feature.
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72211Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42211Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
No matching client found for package name 'gcm.play.android.samples.com.gcmquickstart'
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:preDexDebug
:app:dexDebug
AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar ","sources":[{}]}


:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:assembleDebug

BUILD SUCCESSFUL

Total time: 19.379 secs
Alex Lord Mordor
  • 2,890
  • 7
  • 27
  • 47
  • Are you trying to run the sample on a simulator or on a device? If its a simulator it may be similar to this issue http://stackoverflow.com/a/27966767/1410370 – Arthur Thompson Jun 18 '15 at 00:44
  • If you do ./gradlew assembleDebug from the terminal does it build successfully? – Arthur Thompson Jun 18 '15 at 00:44
  • @kroikie I have the -Xmx256m line, and it is the same thing... with the command, it downloads a lot of files, then it builds with no errors. but when I try to Run the app, the error is shown again – Alex Lord Mordor Jun 18 '15 at 02:24
  • I see that the problem comes when I do ./gradlew assembleRelease, any Idea? – Alex Lord Mordor Jun 18 '15 at 02:39
  • Could you post the assembleRelease errors? – Arthur Thompson Jun 18 '15 at 16:07
  • Actually, the gradle console shows "BUILD SUCCESSFUL" but the error is shown. Even with the Release and Debug jajaja, to make it run, I press the "Run app", wait for the error to be shown, then I Sync with Graddle Files, finally the "select device" apears... but I need to do this every time I make a change in the app – Alex Lord Mordor Jun 18 '15 at 20:25
  • Seems like an Android Studio issue or Gradle issue then, make sure that AS is set up to use the gradle wrapper that came with the project File > Settings > Build, Execution, Deployment > Build Tools > Gradle. Also make sure you are using the latest version of AS. Good luck. – Arthur Thompson Jun 19 '15 at 00:03

3 Answers3

14

This works for me:

In build.gradle(app) I have

applicationId "com.examples.Activities"

and in google-services.json I have

"package_name": "com.examples"

I changed

"package_name": "com.examples"

to

"package_name": "com.examples.Activities"
user5863769
  • 141
  • 1
  • 3
3

I was encountered the same problem.

How I solve it is to modify the file "build.gradle(Project: gcm)".

in file of build.gradle(Project: gcm)

buildscript {
...
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
        classpath 'com.google.gms:google-services:1.3.0-beta1'// downgrade it version
    }
}

Hope this would help you.

Ray
  • 568
  • 6
  • 20
0

This must be because you are using different application id for different flavours. I solved it by getting a google-services.json for my application ids.

For more details: google-services.json for different productFlavors

Official: https://developers.google.com/android/guides/google-services-plugin#adding_the_json_file