Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking for google play services with firebase [duplicate]

Declaring dependencies as

compile 'com.google.firebase:firebase-messaging:9.4.0'

I get "can not resolve symbol GoogleApiAvailability" message in the activity's import row

import com.google.android.gms.common.GoogleApiAvailability;

What is wrong?

  • not question's duplicate: Google Play Services are already on the latest version
like image 409
GPack Avatar asked Sep 20 '16 05:09

GPack


4 Answers

Add this line to your build file dependencies:

compile 'com.google.android.gms:play-services-base:9.4.0'

play-services-base is the Play Services base client library and is listed in the Play Services Setup Guide.

like image 91
Bob Snyder Avatar answered Oct 18 '22 21:10

Bob Snyder


I faced same problem but in my case problem solved by just changing the position of apply plugin: 'com.google.gms.google-services' in the build.gradle(Module: app) file.

Line

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

was written at the last in the gradle file. Remove this from here and add it to the top, below the line apply plugin: 'com.android.application' Like this:

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

and click on sync now. Problem solved.

like image 36
Rahul Sharma Avatar answered Oct 18 '22 21:10

Rahul Sharma


For my case just adding this dependency worked -

implementation "com.google.android.gms:play-services-location:16.0.0
like image 3
Gk Mohammad Emon Avatar answered Oct 18 '22 23:10

Gk Mohammad Emon


If your using the latest classpath 'com.google.gms:google-services:4.3.10', for checking the Google PlayServices Availability you can use GoogleApiAvailabilityLight

like image 1
Anoop M Maddasseri Avatar answered Oct 18 '22 21:10

Anoop M Maddasseri