在同步gradle时出现如下错误,我检查了其他与类似问题相关的答案并按照他们的回答进行操作,但仍然出现相同的错误
Failed to resolve: com.google.android.gms:play-services:15.0.1 Install Repository and sync project Show in File Show in Project Structure dialog
当我点击“Install Repository and sync project”时出现以下错误
找不到依赖项“com.google.android.gms:play-services:15.0.1”
以下是应用级别的gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "mpathak.drivetestapp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'src/main/java/Entities', 'src/main/java/mpathak.drivetestapp', 'src/main/java/mpathak.drivetestapp/interfaces', 'src/main/java/interfaces']
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation 'com.google.dagger:dagger:2.6'
annotationProcessor 'com.google.dagger:dagger-compiler:2.6'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.android.gms:play-services-drive:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services:15.0.1'
implementation 'com.google.android.gms:play-services-identity:15.0.1'
}
我的模块gradle(顶层)如下
buildscript {
repositories {
jcenter()
maven {url "https://maven.google.com"}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {url "https://maven.google.com"}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我遵循约定,如
中所述最佳答案
尝试不使用此实现“com.google.android.gms:play-services:15.0.1”
但是像
这样的具体库实现“com.google.android.gms:play-services-gcm:15.0.1”
关于android-studio - 无法解析 : com. google.android.gms :play-services:15. 0.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50845514/