GoogleApiAvailability missed with firebase-messagi

2019-01-19 10:51发布

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

2条回答
We Are One
2楼-- · 2019-01-19 11:22

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.

查看更多
再贱就再见
3楼-- · 2019-01-19 11:35

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.

查看更多
登录 后发表回答