Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android firebase消息:9.4.0错过了GoogleAppAvailability_Android_Firebase_Firebase Cloud Messaging - Fatal编程技术网

Android firebase消息:9.4.0错过了GoogleAppAvailability

Android firebase消息:9.4.0错过了GoogleAppAvailability,android,firebase,firebase-cloud-messaging,Android,Firebase,Firebase Cloud Messaging,将依赖项声明为 compile 'com.google.firebase:firebase-messaging:9.4.0' 我在活动的导入行中收到“无法解析符号GoogleAppAvailability”消息 import com.google.android.gms.common.GoogleApiAvailability; 怎么了 这不是问题的重复:谷歌游戏服务已经在最新版本上了 将此行添加到生成文件依赖项中: compile 'com.google.android.gms:play

将依赖项声明为

compile 'com.google.firebase:firebase-messaging:9.4.0'
我在活动的导入行中收到“无法解析符号GoogleAppAvailability”消息

import com.google.android.gms.common.GoogleApiAvailability;
怎么了

  • 这不是问题的重复:谷歌游戏服务已经在最新版本上了

将此行添加到生成文件依赖项中:

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

play services base
是play services base客户端库,列在中。

我遇到了同样的问题,但在我的例子中,问题是通过更改
apply plugin:com.google.gms.google services'
build.gradle(模块:app)文件中的位置来解决的

线

最后一次写入gradle文件。从这里删除此插件,并将其添加到顶部,即
apply plugin:'com.android.application'
像这样:

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

然后单击“立即同步”。问题解决了。

就我的情况而言,添加此依赖项就行了-

implementation "com.google.android.gms:play-services-location:16.0.0

sdk中的check Android Support Repository可能是最新版本??Android Support Repository是rev.38。Google Play Services和Google Repository版本为rev.32。将插件行移到顶部可能会导致依赖版本之间的不一致问题。这就是为什么建议将其放在底部,如下所述:->“此步骤要求应用插件:'com.google.gms.google services'行位于app/build.gradle文件的底部,以便不会引入依赖冲突。”
implementation "com.google.android.gms:play-services-location:16.0.0