[英]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.