Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter AndroidManifest Error

I just ported a project built in an earlier version of Flutter and Android studio to a new machine and updated software. When attempting to build my Android project in the emulator, I'm getting the following error...

  • What went wrong: Execution failed for task ':app:processDebugManifest'.

    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 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.

This is what my Manifest looks like...

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.myfavkpopflutterexample"
 xmlns:tools="http://schemas.android.com/tools"
>

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" />

<!-- The INTERNET permission is required for development. Specifically,
     flutter needs it to communicate with the running application
     to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
     calls FlutterMain.startInitialization(this); in its onCreate method.
     In most cases you can leave this as-is, but you if you want to provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->
<application android:name="io.flutter.app.FlutterApplication" android:label="myfavkpopflutter_example" android:icon="@mipmap/ic_launcher">
    <activity android:name=".MainActivity"
              android:launchMode="singleTop"
              android:theme="@android:style/Theme.Black.NoTitleBar"
              android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
              android:hardwareAccelerated="true"
              android:windowSoftInputMode="adjustResize">
        <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                tools:replace="android:value"
                android:value="true" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
</application>

I've added the suggested tools:replace="android:value" and I'm still getting same error. I've seen similar questions that was Android Studio only. I'm adding this to SO because I think it may be related to my Flutter build.

like image 572
Charles Jr Avatar asked Apr 22 '18 01:04

Charles Jr


3 Answers

I have the same problem too. I resolved the problem by applying the suggestion in error message. Adding tools:replace="android:label" in (\android\app\src\main\AndroidManifest.xml) add tools:replace="android:label" like this:

<application
    tools:replace="android:label"
    android:name="io.flutter.app.FlutterApplication"
    android:label="flutterwp" 
    android:icon="@mipmap/ic_launcher">

and don't forget add tools like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.wp"
xmlns:tools="http://schemas.android.com/tools">
like image 147
hs777it Avatar answered Oct 12 '22 23:10

hs777it


I had this issue too but I solved by this. Go to project directory/build, then you will see google_sign_in, image_picker, firebase folder, or any installed dependencies. Delete them. Go back to the pubspec file, do the Packages get and Packages upgrade again.

The issue may be the image_picker folder, which deleting image_picker is good enough. If this is really the solved your issue, check out the manifest-merger-debug-report.txt, you will see the reason why. Hope your issue is solved.

like image 39
Jonathan Sum Avatar answered Oct 13 '22 00:10

Jonathan Sum


I had this issue when I was trying to add AWS Datastore to my Flutter project that already had Google MLKit for local OCR. Either Datastore or MLKit would work, but not both together.

What worked for me:

Adding the following to the app\src\main\AndroidManifest.xml

tools:replace="android:name"

with the following declaration in AndroidManifest -

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ABC"
xmlns:tools="http://schemas.android.com/tools">
like image 37
Nithin Seenivasan Avatar answered Oct 12 '22 23:10

Nithin Seenivasan