2

I've added firebase messaging to my Flutter project.

Works fine on iOS, getting an error when trying to run on Android:

Android dependency 'androidx.localbroadcastmanager:localbroadcastmanager' has different version for the compile (1.0.0-rc01) and runtime (1.0.0) classpath. You should manually set the same version via DependencyResolution

My configuration:

in pubspec.yaml

cloud_firestore: ^0.11.0+2
firebase_auth: ^0.11.1
firebase_messaging: ^5.0.1+1

in android/build.gradle

classpath 'com.google.gms:google-services:4.2.0'

in android/app/build.gradle

implementation 'com.google.firebase:firebase-core:16.0.9'

in gradle.properties

android.useAndroidX=true
android.enableJetifier=true

2 Answers 2

2

I fix the error using this answer. You can work around it by adding the following lines next to other subprojects sections in ../android/build.gradle (not ../android/app/build.grade).

Thanks to mklim for the solution.

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.localbroadcastmanager' &&
                    !details.requested.name.contains('androidx')) {
                details.useVersion "1.0.0"
            }
        }
    }
}

my version: firebase_messaging: ^5.0.4

Sign up to request clarification or add additional context in comments.

Comments

0

Well, the answer was found here: https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility

followed this section: "Manually migrate your app", specifically step 2 helped to sort this out

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.