【发布时间】:2017-12-25 05:38:42
【问题描述】:
在我的 android 应用程序中使用谷歌地图活动时,我收到此错误。
“无法解析 com.google.android.gms:play-services:11.8.0。”
项目级别 Gradle 文件:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用程序级别 Gradle 文件:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services:11.8.0'
}
【问题讨论】:
-
检查您是否还在 Android SDK 管理器的 Extras 下安装了“Google Repository”。
-
是的,我已经安装了。
-
我在尝试从 Android Studio 构建项目时遇到了同样的问题。请尝试从控制台构建它。然后,当所有依赖项都下载完毕后,切换回 android studio
标签: android google-maps android-gradle-plugin google-play-services build.gradle