【问题标题】:Failed to resolve: com.google.android.gms:play-services无法解决:com.google.android.gms:play-services
【发布时间】:2019-04-15 23:07:37
【问题描述】:

以下错误消息显示在控制台中。 无法解决: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 检查你的依赖树。

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

目前我的app 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'

而我的项目gradle如下:

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

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'

【问题讨论】:

  • 发布你的 gradle 文件
  • 添加请检查
  • 保持所有版本的firebase和google依赖..
  • 我应该坚持的任何特定版本?保留所有 15.0.1 引入了新问题,例如无法解决:com.google.firebase:firebase-core:15.0.1 无法解决:com.google .firebase:firebase-messaging:15.0.1 无法解决:com.google.firebase:firebase-perf:15.0.1 无法解决:com.google.android.gms:play-services:15.0.1 无法解决: com.google.android.gms:play-services:15.0.1
  • 使用 16.0.0 或 16.0.1

标签: android


【解决方案1】:

我可以看到没有 15.0.1 发布的版本。

请在此处查看发行说明

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

【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 2018-11-23
      • 1970-01-01
      • 2016-10-09
      • 2018-01-04
      • 2017-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多