代码之家  ›  专栏  ›  技术社区  ›  live-love

在项目“app”中,已解决的Google Play服务库依赖于另一个精确版本的库。

  •  2
  • live-love  · 技术社区  · 7 年前

    尝试用FireStore和Google认证创建一个简单的应用程序。毕业生有问题:

    在“应用程序”项目中,解决了Google Play服务库依赖性问题。 取决于另一个精确版本(例如“[15.0.1”,但不是 正在解析为该版本。图书馆表现出的行为 是未知的。

    依赖失败:com.google.android.gms:play services flags:15.0.1 ->com.google.android.gms:游戏服务地下室@[ 15.0.1),但Play Services地下室版本为16.0.1。

    以下依赖项是直接或 具有可传递的依赖关系,从而导致艺术与 问题。 --项目“app”依赖于com.google.firebase:firebase firestore@17.1.5 --项目“app”依赖于com.firebase ui:firebase ui auth@4.2.0

    对于扩展调试信息,从命令行执行GRADLE ../gradlew--info:app:assembledebug以查看 伪影。此错误消息来自Google Services Gradle 插件,在https/上报告问题/ github.com/google/play-services-plugins并通过添加禁用 “googleservices disableversioncheck=false”到b uild.gradle 文件。

        apply plugin: 'com.android.application'
    
        android {
            compileSdkVersion 27
            defaultConfig {
                applicationId "myapp.com"
                minSdkVersion 19
                targetSdkVersion 27
                versionCode 11
                versionName "1.1"
                testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
                multiDexEnabled true
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                }
            }
        }
    
        dependencies {
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'com.android.support:appcompat-v7:27.1.1'
            implementation 'com.android.support.constraint:constraint-layout:1.1.3'
            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-firestore:17.1.5'
    
            implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
    
        }
    
        apply plugin: 'com.google.gms.google-services'
        com.google.gms.googleservices.GoogleServicesPlugin
    

    项目等级:

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

    有人能帮我吗?

    2 回复  |  直到 7 年前
        1
  •  2
  •   live-love    7 年前

    问题是它缺少依赖项。 添加com.google.firebase:firebase auth解决了这个问题。

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        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-firestore:17.1.5'
    
    //    implementation'com.google.firebase:firebase-core:16.0.6'
    //    implementation'com.google.firebase:firebase-storage:16.0.5'
    
        implementation'com.google.firebase:firebase-auth:16.1.0' => add this line
        implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
    }
    
        2
  •  0
  •   mco    7 年前

    将我所有的Google Play服务库更新到所有模块中的最新版本为我解决了这个问题。我不认为你有任何Google Play服务库,但是我想把这个答案留给那些可能会发现这个有用的人。

    推荐文章