java - 无法解析 : com. google.android.gms :play-services-gcm:7. 5.+

标签 java android notifications google-cloud-messaging

我正尝试在我的应用中包含 GCM。

我不断收到此错误消息:

Failed to resolve: com.google.android.gms:play-services-gcm:7.5.+ | Install Repository and sync project | Show in Project Structure dialog

如果我尝试安装存储库和同步项目,我会收到此错误:

Loading SDK information... Ignoring unknown package filter 'extra-google-m2repository'Warning: The package filter removed all packages. There is nothing to install. Please consider trying to update again without a package filter.

这是我的 gradle 文件:

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

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    ...

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:22.2.1'
        compile 'com.google.android.gms:play-services-gcm:7.5.+'

//顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.google.gms:google-services:1.3+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

最佳答案

您能否检查Android SDK 管理器中的必要包是否是最新的。

并使用

compile 'com.google.android.gms:play-services-gcm:7.5.0'

希望对您有所帮助。

关于java - 无法解析 : com. google.android.gms :play-services-gcm:7. 5.+,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32240265/

相关文章:

java - 用Glide控制GIF动画

android - 使用 RecyclerView 时应用崩溃

android - 如何更改 PopupMenu 项目的字体

iOS - 始终保持与本地网络设备的网络套接字连接

java - 从 Swagger 中删除额外的参数

java - 视频播放询问安全定时器重置

java - 解释语法 EditText editText = (EditText) findViewById(R.id.edit_message);

java - Android APK:重复条目:org/objectweb/asm/AnnotationVisitor.class

ios - 从本地通知打开应用程序后动画标签 [Swift 3.0 - Xcode 8]

android - 有没有办法让通知保持 Activity 状态,直到用户点击清除?