Flutterfire: [all] android.arch.lifecycle:runtime version problem

Created on 24 Nov 2019  路  3Comments  路  Source: FirebaseExtended/flutterfire

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

  1. install Flutter on Mac
  2. create new app flutter create fluttertest
  3. run the app on Android (connected device) - works fine
  4. now install Firebase following instructions for Android on Firebase docs - works fine
  5. add firebase_core: ^0.4.0+9 to pubspec.yaml
  6. wait for flutter pub get to complete
  7. re-run the app - works fine
  8. here's where things go pear shaped:
  9. add ANY of the firebase libs eg. firebase_dynamic_links: ^0.5.0+8 or cloud_firestore: ^0.12.10+2 to pubspec.yaml
    wait for flutter pub get to complete
    re-run the app - FAIL !

Expected behavior
Correct versions somehow & no error :)

Additional context
See notice on top.

bug

Most helpful comment

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?

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings