Android Studio 2.2.2:无法解析 Google 播放服务
Android Studio 2.2.2: Failed to resolve Google Play-Services
我试图创建一个基于 Google 地图的演示项目,为此我使用了 android 工作室提供的 MapsActivity。除了 Google Play 服务,一切都很好。 Android 工作室无法解析播放服务并抛出错误-
Error:(27, 13) Failed to resolve: com.google.android.gms:play-services:9.4.0
Install Repository and sync project
Show in File
Show in Project Structure dialog
项目Gradle
// 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:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.mymapapplication"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.android.gms:play-services:9.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我有更新的 sdk 工具 Google 播放服务 v-33 和 Google 存储库 v-36.
我尝试了很多方法来处理它,但仍然面临同样的问题。
问题已解决,这是存储库 link 上的错误。
"Install Google Repository" failed.
Failed packages:
- Google Repository (extras;google;m2repository)
现在新的 link- https://dl.google.com/android/repository/google_m2repository_gms_v7_rc28_wear_2a3.zip(此时)工作正常,我更新了我的 google 存储库和 google 播放服务及其工作魅力.
我试图创建一个基于 Google 地图的演示项目,为此我使用了 android 工作室提供的 MapsActivity。除了 Google Play 服务,一切都很好。 Android 工作室无法解析播放服务并抛出错误-
Error:(27, 13) Failed to resolve: com.google.android.gms:play-services:9.4.0
Install Repository and sync project
Show in File
Show in Project Structure dialog
项目Gradle
// 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:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.mymapapplication"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.android.gms:play-services:9.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我有更新的 sdk 工具 Google 播放服务 v-33 和 Google 存储库 v-36. 我尝试了很多方法来处理它,但仍然面临同样的问题。
问题已解决,这是存储库 link 上的错误。
"Install Google Repository" failed.
Failed packages:
- Google Repository (extras;google;m2repository)
现在新的 link- https://dl.google.com/android/repository/google_m2repository_gms_v7_rc28_wear_2a3.zip(此时)工作正常,我更新了我的 google 存储库和 google 播放服务及其工作魅力.