颤振问题云存储依赖

时间:2019-02-01 18:44:26

标签: android flutter google-cloud-firestore

我有一个运行良好的flapp应用程序,但是当我添加cloud-firestore依赖项时,它崩溃:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
Android dependency 'android.arch.lifecycle:runtime' has different version for the compile (1.0.0) and runtime (1.1.1) classpath. You should manually set the same version via DependencyResolution

这是我的pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

    #FIRESTORE
    cloud_firestore: ^0.9.0

我该如何解决?

问候,迭戈

3 个答案:

答案 0 :(得分:1)

似乎我需要更多的配置,而不仅仅是添加cloud_firestore依赖项。我已遵循本教程https://www.gotut.net/flutter-firestore-tutorial-part-1/

摘要:

我不得不将cloud_firestore:^ 0.9.0更改为cloud_firestore:^ 0.8.2 + 3。

Pubspec.yaml:

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  #FIRESTORE
  cloud_firestore: ^0.8.2+3

.android / build.gradle:

dependencies {
    ...
    classpath 'com.google.gms:google-services:4.2.0'
}
...
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                  && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}

.android / app / build.gradle:

apply plugin: 'com.google.gms.google-services'
android {
    defaultConfig {
        ...        
        multiDexEnabled true
    }
}

答案 1 :(得分:0)

此发生是因为依赖冲突的对方。只需将您的cloud_firestore降级到较旧的版本,即将 cloud_firestore:^ 0.9.0 替换为 cloud_firestore:^ 0.8.2 + 1 或任何较旧的版本

答案 2 :(得分:0)

浪费大量时间后我需要为我工作的设置:

pubspec.yaml   firebase_auth:^ 0.6.6   google_sign_in:^ 3.2.4   firebase_core:^ 0.2.5 + 1   cloud_firestore:^ 0.8.2 + 3

app \ build.gradle   minSdkVersion 21(原为16)   并且没有添加任何依赖项{    }

项目build.gradle   ” com.google.gms:google-services:4.0.1”(不适用于上述niegus的4.2.0)