我无法为 Google Play 服务编译实例 ID

I am not able to compile Instance id for Google Play Services

我正在尝试添加实例 ID(最后一行)

dependencies {
   //Basic Google libs
   compile 'com.android.support:support-v4:+'
   compile 'com.android.support:appcompat-v7:22.2.0'
   compile 'com.google.android.gms:play-services-base:7.5.0'
   compile 'com.google.android.gms:play-services-gcm:7.5.0'
   compile 'com.google.android.gms:play-services-location:7.5.0'
   compile 'com.google.android.gms:play-services-maps:7.5.0'
   compile 'com.google.android.gms:play-services-wallet:7.5.0'
   compile 'com.google.android.gms.iid:7.5.0'
}

但我不断收到:

Error:Failed to resolve: com.google.android.gms.iid:7.5.0:

知道为什么吗?

没有什么比 : 'com.google.android.gms.iid:7.5.0' 由 google 播放服务

提供

如果您正在寻找身份服务,那么它应该是:

com.google.android.gms:play-services-identity:7.5.0

参考 link : https://developers.google.com/android/guides/setup

对于正在搜索 InstanceId 新 GCM Firebase 云消息传递的每个人,请改用 FirebaseInstanceId。有:

FirebaseInstanceId.getInstance().getToken();

https://firebase.google.com/docs/cloud-messaging/android/client#sample-register

阅读更多内容

不确定 7.5 版 但对于 10.0.1 只需使用

compile 'com.google.android.gms:play-services-iid:10.0.1'