找不到与com.google.android.gms:play-services:[15.0.0,16.0.0)匹配的任何版本

时间:2018-09-08 14:35:19

标签: android

我使用firebase和onesignal,但是打开项目时出现错误, 我更新了构建工具,SDK工具和Google Play服务。

  

错误:无法解决“:app @ debug / compileClasspath”的依赖项:找不到与com.google.android.gms:play-services:[15.0.0,16.0.0)匹配的任何版本。   打开文件
显示详细信息

     

错误:无法解决':app @ release / compileClasspath'的依赖关系:找不到与com.google.android.gms:play-services:[15.0.0,16.0.0)匹配的任何版本。   打开文件
显示详细信息

build.gradle(项目)

buildscript {

repositories {
    google()
    jcenter()


}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.1'
    classpath 'com.google.gms:google-services:4.1.0'
    // 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://dl.bintray.com/drummer-aidan/maven'

    }
    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.11.0, 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 27
defaultConfig {
    applicationId "ir.tethys.app"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    manifestPlaceholders = [
            onesignal_app_id               : '811bb48c-2350-455d-aa7d-63eea30e226e',
            // Project number pulled from dashboard, local value is ignored.
            onesignal_google_project_number: '845923319180'
    ]

}
buildTypes {

    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}
buildToolsVersion '28.0.2'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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.android.support:design:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.nabinbhandari.android:permissions:3.5'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.afollestad:easyvideoplayer:0.3.0'
implementation 'com.zarinpal:purchase:0.0.3-beta'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.ss.bottomnavigation:bottomnavigation:1.5.2'
implementation project(':infinitescrollprovider')
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.android.gms:play-services:12.0.1'
}

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

1 个答案:

答案 0 :(得分:0)

尝试将maven { url "https://maven.google.com" }添加到您的根级别build.gradle文件中,如下所示:

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

如果您的Gradle插件版本支持,您也可以这样做:

allprojects {
    repositories {
        google()
        jcenter()
    }
}