无法解决:com.google.android.gms:play-services

时间:2018-11-13 07:03:45

标签: android

以下错误消息显示在控制台中。 无法解决:com.google.android.gms:play-services:15.0.1 安装存储库并同步项目 显示在文件中 在“项目结构”对话框中显示

此外,如果我尝试安装存储库,我还将面临以下问题: 找不到依赖项“ com.google.android.gms:play-services:15.0.1

Gradle文件如下:

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply plugin: 'org.sonarqube'
android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "fsit.luvder"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 3
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    defaultConfig {

        // Enabling multidex support.
        multiDexEnabled true
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/rxjava.properties'

        exclude 'error_prone/Annotations.gwt.xml'
        exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
        exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
    }


    sonarqube {
        properties {
            property "sonar.projectName", "Kairos"
            property "sonar.projectKey", "Luvder"
            property "sonar.sources","src/main/java"
            property "sonar.language","java"
            property "sonar.sourceEncoding", "UTF-8"
        }
    }


}

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation project(':drawer')
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.facebook.android:facebook-android-sdk:4.30.0'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.google.android.gms:play-services:15.0.1'
    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
    implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.intuit.sdp:sdp-android:1.0.3'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.joooonho:selectableroundedimageview:1.0.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.roughike:bottom-bar:1.2.1'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    implementation 'com.longtailvideo.jwplayer:jwplayer-core:+'
    implementation 'com.longtailvideo.jwplayer:jwplayer-common:+'
    implementation 'com.longtailvideo.jwplayer:jwplayer-ima:+'
    // Only required if using IMA features
    implementation 'com.longtailvideo.jwplayer:jwplayer-chromecast:+'
    // Only required if using Chromecast
    testImplementation 'junit:junit:4.12'
    implementation 'com.google.android.gms:play-services:15.0.'
    implementation 'com.github.ozodrukh:CircularReveal:1.0.4'
    implementation 'me.relex:circleindicator:1.2.2@aar'
}







configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

apply plugin: 'jacoco'
jacoco {
    version "0.7.1.201405082137"
}


jacoco {
    toolVersion "0.7.1.201405082137"
}

def coverageSourceDirs = [
        'src/main/java',
]

task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
    group = "Reporting"
    description = "Generate Jacoco coverage reports after running tests."
    reports {
        xml.enabled = true
        html.enabled = true
    }
    classDirectories = fileTree(
            dir: './build/intermediates/classes/debug',
            excludes: ['**/R*.class',
                       '**/*$InjectAdapter.class',
                       '**/*$ModuleAdapter.class',
                       '**/*$ViewInjector*.class'
            ])
    sourceDirectories = files(coverageSourceDirs)
    executionData = files("$buildDir/jacoco/testDebug.exec")
    doFirst {
        new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
            if (file.name.contains('$$')) {
                file.renameTo(file.path.replace('$$', '$'))
            }
        }
    }
}
apply plugin: 'com.google.gms.google-services'

编辑: 我有一个新问题,如下所示: 各种其他库都在[[15.0.1,15.0.1]]请求com.google.android.gms:play-services-base库,但解析为16.0.1。禁用插件,并使用./gradlew:app:dependencies检查您的依赖关系树。

更新:即使在回答之后,仍然面临与编辑中提到的相同的问题。感谢您。寻求专业知识。

目前,我的应用gradle文件如下:

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'io.fabric'
apply plugin: 'org.sonarqube'


android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "fsit.luvder"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 3
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    defaultConfig {

        // Enabling multidex support.
        multiDexEnabled true
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/rxjava.properties'

        exclude 'error_prone/Annotations.gwt.xml'
        exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
        exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
    }


    sonarqube {
        properties {
            property "sonar.projectName", "Kairos"
            property "sonar.projectKey", "Luvder"
            property "sonar.sources","src/main/java"
            property "sonar.language","java"
            property "sonar.sourceEncoding", "UTF-8"
foo/Foo.java"
        }
    }



}

dependencies {
    implementation 'com.google.firebase:firebase-messaging:16.0.1'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    implementation 'com.google.firebase:firebase-perf:16.0.1'
    implementation "com.google.firebase:firebase-auth:16.0.1"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation project(':drawer')
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.facebook.android:facebook-android-sdk:4.30.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'

    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
    implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
    implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'com.android.support:support-v4:27.0.2'
    implementation 'com.intuit.sdp:sdp-android:1.0.3'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.joooonho:selectableroundedimageview:1.0.1'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.roughike:bottom-bar:1.2.1'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    implementation 'com.github.ybq:Android-SpinKit:1.1.0'
    implementation 'com.longtailvideo.jwplayer:jwplayer-core:+'
    implementation 'com.longtailvideo.jwplayer:jwplayer-common:+'
    implementation 'com.longtailvideo.jwplayer:jwplayer-ima:+'
    // Only required if using IMA features
    implementation 'com.longtailvideo.jwplayer:jwplayer-chromecast:+'
    // Only required if using Chromecast
    testImplementation 'junit:junit:4.12'
    //implementation 'com.google.android.gms:play-services:16.0.1'
    implementation 'com.github.ozodrukh:CircularReveal:1.0.4'
    implementation 'me.relex:circleindicator:1.2.2@aar'
}






configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}


apply plugin: 'jacoco'

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true


jacoco {
    version "0.7.1.201405082137"
}


jacoco {
    toolVersion "0.7.1.201405082137"
}

def coverageSourceDirs = [
        'src/main/java',
]

task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") {
    group = "Reporting"
    description = "Generate Jacoco coverage reports after running tests."
    reports {
        xml.enabled = true
        html.enabled = true
    }
    classDirectories = fileTree(
            dir: './build/intermediates/classes/debug',
            excludes: ['**/R*.class',
                       '**/*$InjectAdapter.class',
                       '**/*$ModuleAdapter.class',
                       '**/*$ViewInjector*.class'
            ])
    sourceDirectories = files(coverageSourceDirs)
    executionData = files("$buildDir/jacoco/testDebug.exec")
    doFirst {
        new File("$buildDir/intermediates/classes/").eachFileRecurse { file ->
            if (file.name.contains('$$')) {
                file.renameTo(file.path.replace('$$', '$'))
            }
        }
    }
}
apply plugin: 'com.google.gms.google-services'

我的项目收益如下:

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

buildscript {
    repositories {
        google()

        mavenCentral()
        maven { url "https://jitpack.io"

        }
        maven {
            url 'https://maven.fabric.io/public'
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }

        maven {
            url "https://plugins.gradle.org/m2/"
        }

        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
        classpath 'io.fabric.tools:gradle:1.25.4'
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"


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

def isReleaseBuild() {
    return version.contains("SNAPSHOT") == false
}


allprojects {
    repositories {
        google()

        maven { url "https://jitpack.io" }
        maven {
            url 'https://mvn.jwplayer.com/content/repositories/releases/'
        }
        maven {
            url 'https://maven.google.com/'
        }
        jcenter()

    }
}

ext {
    sdk = 25
    buildTools = "24.0.2"
    minSdk = 14
    libraryVersion = "1.0.4"
    supportVersion = "25.0.0"
}


task clean(type: Delete) {
    delete rootProject.buildDir
}
task wrapper(type: Wrapper) {
    gradleVersion = '2.13'
    distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}
apply plugin: 'android-reporting'

2 个答案:

答案 0 :(得分:0)

我看到没有发布15.0.1版本。

请在此处查看发行说明

https://developers.google.com/android/guides/releases

答案 1 :(得分:0)