[英]flutter cloud-firestore MissingPluginException Exception
[英]Flutter problem cloud-firestore dependency
我有一个运行良好的 flutter 应用程序,但是当我添加 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
我怎样才能解决这个问题?
问候, 迭戈
似乎我需要更多的配置而不仅仅是添加 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
}
}
这是因为依赖关系相互冲突。 只需将您的 cloud_firestore 降级到旧版本,即用cloud_firestore: ^0.8.2+1或任何旧版本替换cloud_firestore: ^0.9.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' (不是 4.2.0,它适用于上面的 niegus)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.