【问题标题】:I am not able to compile Instance id for Google Play Services我无法为 Google Play 服务编译实例 ID
【发布时间】:2015-07-06 19:12:48
【问题描述】:

我正在尝试添加实例 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'
}

但我不断得到:

错误:无法解决:com.google.android.gms.iid:7.5.0:

有什么线索吗?

【问题讨论】:

    标签: android android-studio google-play-services


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      谷歌播放服务提供的没有类似:'com.google.android.gms.iid:7.5.0'

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

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

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

      【讨论】:

      • 是的,我很笨。我有一个脑袋放屁。那是包名
      • 谢谢。我只是删除了不存在的“com.google.android.gms:play-services-iid”(并保留了“com.google.android.gms:play-services-gcm”)。
      【解决方案3】:

      对于为新 GCM Firebase 云消息传递搜索 InstanceId 的所有人,请改用 FirebaseInstanceId。与:

      FirebaseInstanceId.getInstance().getToken();
      

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-09-26
        • 1970-01-01
        • 1970-01-01
        • 2018-03-31
        • 2014-04-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多