Gradle could not find dependency com.google.android.gms:play-services(Gradle 找不到依赖项 com.google.android.gms:play-services)
问题描述
自从我将 Android Studio 升级到 3.0.0 后,我遇到了一个问题:我找不到 com.google.android.gms:play-services
了!
I have a problem since I upgraded my Android Studio to 3.0.0 : I cannot find com.google.android.gms:play-services
anymore!
添加此依赖项后,当我尝试同步我的项目时,我收到此消息:
After adding this dependency, when I try to sync my project I get this message :
Failed to resolve: com.google.android.gms:play-services-games:11.4.2
我可以单击安装存储库并同步项目",但是当我这样做时,我会收到以下消息:
I can click on "Install repository and sync project" but when I do, I get this message :
Could not find dependency "com.google.android.gms:play-services-games:11.4.2"
我尝试搜索,但找到的唯一解决方案是安装 Google 存储库,并将 jcenter()
添加到我的 build.gradle
文件中的存储库但我已经这样做了!
I tried to search, but the only solutions I found was to install Google repository, and add jcenter()
to the repositories in my build.gradle
file
But I already did that!
有什么想法吗?
这是我的 build.gradle 文件:
Here is my build.gradle file :
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "Glowee"
gdxVersion = '1.9.7'
roboVMVersion = '2.3.1'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
compile "com.google.android.gms:play-services-games:11.4.2"
compile "com.google.android.gms:play-services-ads:11.4.2"
compile "com.google.android.gms:play-services-plus:11.4.2"
}
}
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
dependencies {
compile project(":core")
compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
推荐答案
我通过在 build.gradle 项目模块中添加 google() 存储库解决了这个问题
i fixed the issue by adding google() repository in build.gradle project module
这篇关于Gradle 找不到依赖项 com.google.android.gms:play-services的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Gradle 找不到依赖项 com.google.android.gms:play-services
基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01