Java 无法解析:com.google.android.gms:play-services-gcm:7.5.+
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32240265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to resolve: com.google.android.gms:play-services-gcm:7.5.+
提问by Joolah
I am trying to include GCM in my app.
我正在尝试在我的应用程序中包含 GCM。
I keep getting this error message :
我不断收到此错误消息:
Failed to resolve: com.google.android.gms:play-services-gcm:7.5.+ | Install Repository and sync project | Show in Project Structure dialog
无法解析:com.google.android.gms:play-services-gcm:7.5.+ | 安装 Repository 并同步项目 | 在项目结构对话框中显示
If I try to Install Repository and sync project i get this error:
如果我尝试安装存储库并同步项目,我会收到此错误:
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.
正在加载 SDK 信息...忽略未知包过滤器“extra-google-m2repository”警告:包过滤器删除了所有包。没有什么可以安装的。请考虑尝试在没有包过滤器的情况下再次更新。
Here is my gradle file:
这是我的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.+'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// 顶级构建文件,您可以在其中添加所有子项目/模块通用的配置选项。
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()
}
}
回答by IntelliJ Amiya
Could you check that the necessary packagesin your Android SDK Manager are up to date.
你可以检查必需的包在你的Android SDK Manager are up to date.
And use
并使用
compile 'com.google.android.gms:play-services-gcm:7.5.0'
I hope it will helps you .
我希望它会帮助你。
回答by Roman Dezhin
I once encountered the same error after updating Android Studio and SDK.
我曾经在更新 Android Studio 和 SDK 后遇到同样的错误。
You could try to use 'com.android.tools.build:gradle:1.3.0'
instead of 'com.android.tools.build:gradle:1.2.3'
in Project gradle file.
您可以尝试在 Project gradle 文件中使用'com.android.tools.build:gradle:1.3.0'
而不是'com.android.tools.build:gradle:1.2.3'
。
回答by theblang
Changing from 7.5.+
to 7.5.0
fixed this issue for me. I'm not sure why the wildcard caused an issue.
从改变7.5.+
到7.5.0
修复了这个问题对我来说。我不确定为什么通配符会导致问题。
回答by FunkSoulBrother
Updating the SDK resolved this issue for me.
更新 SDK 为我解决了这个问题。
回答by Paritosh
I know this question has been answered well but just to add something for those who come across a similar error and are seeing this page.
我知道这个问题已经得到了很好的回答,但只是为那些遇到类似错误并看到此页面的人添加一些内容。
Failed to resolve usually pops up when you are updating the dependencies (read google support libraries) to a newer version and your project is using older version of Google Play Services (look in Android SDK Manager under Extras).
当您将依赖项(读取 google 支持库)更新到较新版本并且您的项目使用较旧版本的 Google Play 服务(查看 Extras 下的 Android SDK 管理器)时,通常会弹出无法解决。
To resolve this just update the Google Play Services to the latest version and then Sync your build.gradle (app). This should resolve similar issues.
要解决此问题,只需将 Google Play 服务更新到最新版本,然后同步您的 build.gradle(应用程序)。这应该可以解决类似的问题。
回答by BlackHatSamurai
For what it's worth, I had this error when I updated from 10.1.1 to 10.2.0. I tried using 10.2, but found that I had to use the full version number: 10.2.0 (the last zero matters). Hope this helps someone.
值得一提的是,当我从 10.1.1 更新到 10.2.0 时遇到了这个错误。我尝试使用 10.2,但发现我必须使用完整版本号:10.2.0(最后一个零很重要)。希望这可以帮助某人。
回答by Obrazcoff
For me - help:
对我来说 - 帮助:
- to go to Tools -> Android -> SDK Manager
- in Android SDKfrom left list choice tab SDK Tools
- Check all need to updatepackages
- You need a lot of free space on disk and a lot of time (for me with SSD disk it takes about 1 hour)
- 转到工具 -> Android -> SDK 管理器
- 在Android SDK 中从左侧列表选择选项卡SDK Tools
- 检查所有需要更新的软件包
- 您需要大量的磁盘可用空间和大量时间(对我来说,使用 SSD 磁盘大约需要 1 小时)
After that your project should work fine.
之后,您的项目应该可以正常工作。