0

I finally managed to get google app invites working in my app. I enabled them on the developer console and followed this guide. The following steps were giving me problems:

  • Add the dependency to your project's top-level build.gradle:

    classpath 'com.google.gms:google-services:1.3.0-beta1'

  • Add the plugin to your app-level build.gradle:

    apply plugin: 'com.google.gms.google-services'

  • Copy the google-services.json file you just downloaded into the app/ or mobile/ directory of your Android Studio project.

By adding that classpath I had to use jcenter as my repository, as this package isn't available at mavenCentral. However, even if I built the project with jcenter as a repository, the gradle build failed with an empty error message. I tried to debug the problem but the stacktrace for the crash was enormous.

My solution was to simply ignore these steps. The app invites are working flawlessly since then.

With this in mind, here goes my question. Why were all these steps listed on the official google guide if they are not necessary? Am I missing something here?

Fabio Picchi
  • 1,132
  • 2
  • 9
  • 21

2 Answers2

1

When I started official sample for Invite API yesterday, I had problem but just because of version of google-services (1st step -> add the dependency of your project's top-level build.gradle), so I have to change it to the latest version: classpath 'com.android.tools.build:gradle:1.3.0-beta4' classpath 'com.google.gms:google-services:1.3.0-beta4'

and this solves all problems. I don't understand your question, which step you exactly skipped of these 3 steps mentioned and made invite api functional?

  • I skipped the 3 steps that I listed. I am not using com.google.gms:google-services. Also I am not using that plugin and neither have I added google-services.json to my project. My question is: how I got things to work without adding these dependencies? – Fabio Picchi Jul 22 '15 at 17:53
  • And my question is, how did it work without the .json file? Cause, there contains all keys to your activated services right? – Tonespy Sep 03 '15 at 12:44
  • I have no idea of how it works, that's exactly my question. – Fabio Picchi Sep 03 '15 at 18:02
  • I started a separate question for this: http://stackoverflow.com/questions/32795360/how-is-app-invites-working-without-google-services-json – Mark Sep 26 '15 at 11:19
0

Finally found the answer. The service was working on my prototype because it doesn't check for credentials on the test device. Once released to public, the keys are needed for the service to work correctly as Ituoke Ajanlekoko said in the comments.

Further information can be found at this topic: What does google-services.json really do?

Community
  • 1
  • 1
Fabio Picchi
  • 1,132
  • 2
  • 9
  • 21