Search code examples
fluttergoogle-mapsdartandroid-manifestfluttermap

Error parsing LocalFile: 'E:\android\app\src\main\AndroidManifest.xml' Please ensure that the android manifest is a valid XML document and try again


my application worsks perfectly fine. but when i add some uses-permission for internet and map and api key for google map it gives me error. i tried flutter clean, flutter run but still getting the same error. I dont understand what i am doing wrong in manifest file. please someone help me.

Here is my manifest file code:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.food_order">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<application
    android:label="food_order"
    android:icon="@mipmap/ic_launcher"
    
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
       
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
       
        <meta-data
          android:name="io.flutter.embedding.android.SplashScreenDrawable"
          android:resource="@drawable/launch_background"
          />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="AIzaSyCn************ratM"/>  
  
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>
</manifest>

Solution

  • You are missing > after the android:icon="@mipmap/ic_launcher", so it should be like this:

    <application
        android:label="food_order"
        android:icon="@mipmap/ic_launcher">
    
    <activity...
    

    Your IDE should have given you hints about this, like so IDE hint

    If you aren't using an IDE I strongly suggest you start using one :).