1

After upgrading the flutter , when i build my app i started getting following error:

Execution failed for task ':app:processDebugManifest'. [ +5 ms] > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35 [ +23 ms] is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). [ +8 ms] Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.

As explained in add 'tools:replace="Android:value"' to <meta-data> element at AndroidManifest and Android: Getting "Manifest merger failed" error after updating to a new version of gradle SO answers i added the

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.4.0'
            }
        }
    }
}

to my app folder build.gradle :

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 27

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.yourcompany.chatapp"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.4.0'
            }
        }
    }
}
apply plugin: 'com.google.gms.google-services'

Now whenever i run my app i get the following Error :

Error -32601 received from application: Method not found

I have tried by running flutter clean, the error still persists.

Here is output of flutter doctor :

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.3.1, on Microsoft Windows [Version 10.0.16299.371], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.0-rc1)
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)

• No issues found!
Cœur
  • 37,241
  • 25
  • 195
  • 267
Hummingbird
  • 647
  • 8
  • 27

2 Answers2

0

I Found out that the original issue :

Execution failed for task ':app:processDebugManifest'. [ +5 ms] > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35 [ +23 ms] is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). [ +8 ms] Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.

Might have been due to older firebase packages dependencies.

My initial pubspec.yaml dependencies looked something like :

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.0
  contact_picker:  ^0.0.2
  connectivity: ^0.3.0
  image_picker: 0.1.1
  google_sign_in: 0.3.1
  firebase_analytics: 0.0.4
  firebase_auth: 0.2.0
  firebase_database: 0.0.1
  firebase_storage: 0.0.5
  firebase_messaging: 0.2.5

If i update the pubspec.yaml as below :

  cupertino_icons: ^0.1.0
  contact_picker:  ^0.0.2
  connectivity: ^0.3.0
  image_picker: ^0.4.1
  google_sign_in: ^3.0.3
  firebase_analytics: ^0.3.3
  firebase_auth: ^0.5.7
  firebase_database: ^0.4.6
  firebase_storage: ^0.3.3
  firebase_messaging: ^0.2.5

There is no Manifest merger failed in first place hence no changes needed in build.gradle file.

I am not sure how the Manifest merger failed is linked to other firebase packages, however after this solution the build is working fine, and there are no Manifest merger failed or Error -32601 received from application: Method not found error.

Hummingbird
  • 647
  • 8
  • 27
0

Just experienced that same error and can confirm that it was a Firestore package dependency error. I was attempting to update to 0.12.11 when I received the error binding to the service failed.

The solution was to go back to 0.12.10 Firestore plugin and that resolved the issue

KoalaZub
  • 1,087
  • 8
  • 10