错误:无法解析':app @ debug / compileClasspath'的依赖关系:无法解析com.google.android.gms:play-services-base

时间:2020-05-10 06:03:53

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

如您所见,这里是我尝试同步项目时遇到的错误,我一次又一次遇到此问题。 Gradle处于在线模式。我也尝试了离线模式,但发现了同样的问题。

我也尝试了很多方法,但仍然无法解决此问题。

成绩同步错误

ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[10.2.1, 16.1.99]

Build.gradle(项目)

//顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项。

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath 'com.google.gms:google-services:4.3.3'



        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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


    }
}

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

Build.gradle(:app)

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }

    }

    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'


repositories {
    maven { url 'https://maven.google.com' }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        vectorDrawables {
            useSupportLibrary = true
        }
        vectorDrawables.useSupportLibrary = true

        applicationId "com.game.pubg.best.tournaments"

        // TODO: Please update the OneSignal ID below to yours!
        manifestPlaceholders = [onesignal_app_id: '6554b669-a188-4110-8836-b181ff64894b',
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: 'REMOTE']

        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath false
            }
        }
    }
    repositories {
        mavenCentral()
        maven { url 'http://repo1.maven.org/maven2' }
        maven { url "http://jcenter.bintray.com" }
        maven { url "https://www.jitpack.io" }
        maven { url "https://maven.google.com" }
        maven { url 'https://dl.bintray.com/drummer-aidan/maven' }
        maven { url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/" }
        jcenter()
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
//        debug {
//            minifyEnabled true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//        }
    }
}

apply plugin: 'com.google.gms.google-services'


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:support-vector-drawable:28.0.0'

//    implementation 'ai.devsupport.instamojo:instamojolib:0.1.6'

    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2',
            {
                exclude group: 'com.android.support', module: 'support-annotations'
            }
    )
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'


//    implementation 'com.google.android.gms:play-services-ads:17.0.0'

    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.facebook.shimmer:shimmer:0.5.0'

    implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'

    implementation 'com.github.bumptech.glide:glide:4.11.0'

    implementation 'com.onesignal:OneSignal:[3.13.0, 3.99.99]'

    implementation('com.paytm:pgplussdk:1.3.3')
            {
        transitive = true
            }

    implementation 'org.jsoup:jsoup:1.13.1'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.13'
    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-core:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.android.gms:play-services-auth:18.0.0'

}

1 个答案:

答案 0 :(得分:0)

apply plugin: 'com.google.gms.google-services'添加到 build.gradle(:app) 尝试依赖此问题的答案:Android Studio can't find Kotlin dependency