【问题标题】:Failed to resolve: play-services-base无法解决:play-services-base
【发布时间】:2018-12-02 17:18:29
【问题描述】:

错误是不允许 gradle build 成功。

我的项目级别如下:

buildscript {
    repositories {
        jcenter()

        google()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.1' 
        classpath 'io.fabric.tools:gradle:1.24.4'

    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我的应用级 gradle 文件依赖项 依赖关系

{
    implementation 'com.android.support:support-v4:28.0.0-alpha3'
    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'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.android.support:design:28.0.0-alpha3'
    testCompile 'junit:junit:4.12'
    implementation 'com.startapp:inapp-sdk:3.8.1'
    implementation 'com.android.support:gridlayout-v7:28.0.0-alpha3'
    implementation 'com.android.support:support-v4:28.0.0-alpha3'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

我的 Google Repository 版本是 58,Android Support Repository 是 47.0.0,Android SDK Build Tools 是 28.0.0

【问题讨论】:

  • 你在伊朗吗?
  • 不,来自印度。
  • 在伊朗使用 VPN 修复

标签: android android-studio android-gradle-plugin build.gradle google-play-services


【解决方案1】:

注意放置 google() 的位置

allprojects {
repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}

【讨论】:

    【解决方案2】:

    如果您使用的是 Windows,只需删除 C:\users\"username" 中的 .gradle 文件夹

    我从来没有在LinuxMac 有过android studio,但肯定是:~/.gradle

    我的问题就这样解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-18
      • 2018-11-06
      • 1970-01-01
      • 1970-01-01
      • 2019-03-27
      • 2018-11-06
      • 1970-01-01
      • 2022-01-14
      相关资源
      最近更新 更多