Charles Jr
Charles Jr

Reputation: 9109

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...

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.

Upvotes: 8

Views: 17713

Answers (3)

Nithin Seenivasan
Nithin Seenivasan

Reputation: 11

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">

Upvotes: 1

hs777it
hs777it

Reputation: 518

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">

Upvotes: 12

Jonathan Sum
Jonathan Sum

Reputation: 76

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.

Upvotes: 1

Related Questions