I'm copying a bug filed by @ajonno in Flutter's repo here https://github.com/flutter/flutter/issues/45449, because I think it relates more to flutterfire. Check there for more original details and reports.
Describe the bug
Error when adding any firebase library to fresh flutter create app.
"Execution failed for task 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
To Reproduce
all dev work is done in VS Code on Mac, version: 1.40.1
Expected behavior
Correct versions somehow & no error :)
Additional context
See notice on top.
Same issue
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
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
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
Finished with error: Gradle task assembleDebug failed with exit code 1
This comment solved my problem for now: https://github.com/flutter/flutter/issues/27254#issuecomment-477474444
If you have kotlin support in your flutter app, to solve this problem, you need to change 2 values in android/build.gradle:
change kotlin_version from 1.2.71 to 1.3.0
change gradle version from 3.2.1 to 3.3.2
Notice that if you use cloud_firestore you must have a minSdk of >=21 or use the multidex support library.
TBH I think this is way too much configuration because of some version incompatibilities. Is it maybe possible to make a default flutter project run out of the box with flutterfire?
Migrating to Android X, running flutter upgrade and finally following @G710's https://github.com/FirebaseExtended/flutterfire/issues/1490#issuecomment-559290004 suggestion above to require minSdkVersion 21 (in android/app/build.gradle) solved the issue for me. Thanks for the comments!
Most helpful comment
This comment solved my problem for now: https://github.com/flutter/flutter/issues/27254#issuecomment-477474444
Notice that if you use
cloud_firestoreyou must have a minSdk of >=21 or use the multidex support library.TBH I think this is way too much configuration because of some version incompatibilities. Is it maybe possible to make a default flutter project run out of the box with flutterfire?