Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GoogleApiAvailability missed with firebase-messaging:9.4.0

Tags:

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 354
GPack Avatar asked Sep 20 '16 05:09

GPack


2 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 146
Bob Snyder Avatar answered Sep 21 '22 17:09

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 30
Rahul Sharma Avatar answered Sep 18 '22 17:09

Rahul Sharma