Flutter development: prompt error parsing localfile when running the project: ‘/ users / xxx / Android / APP / SRC / main / androidmanifest. XML’… Solution

preface

At the beginning of the development of flutter, there are all kinds of problems. At this time, it is a little difficult for the developers who have just contacted the development of flutter. Therefore, in the early stage of the development of flutter, we should accumulate more, consult more and step on more holes, so that we can start to develop the flutter project quickly. This article will share a relatively simple problem encountered in the development of flutter, the error prompted after the operation of flutter packages get.

 
Error message

After running the flutter packages get, the flutter project will prompt the following error prompt:

After executing the command flutter packages get, an error is reported. It is about the Android related prompt in the flutter project

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

exit code 1

analysis

Through the above error prompt, the editor has told the specific location of the error file, so follow the file path of the prompt and enter the corresponding file to check the specific location of the error. However, after checking, no error is found. After performing the flitter clean, the editor runs the flitter run again, and the error is still reported. The corresponding writing method of the specific file is as follows:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.example.platform_app">

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

    <application

        android:name="io.flutter.app.FlutterApplication"

        android:label="platform_app">

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

            <intent-filter>

                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>

            </intent-filter>

        </activity>

        <meta-data

            android:name="flutterEmbedding"

            android:value="2" />

    </application>

</manifest>

Through repeated investigation, we finally found out the problem, label & lt/ manifest> The end tag of is missing one, as shown in the following figure:

 
resolvent

In & gt; And then it was lost android:icon= “@mipmap/ic_ So it should be like this:

<application

    android:name="io.flutter.app.FlutterApplication"

    android:label="platform_app"

    android:icon="@mipmap/ic_launcher">

<activity...

Finally, click save file, run the project again, and no error will be reported directly. The project flutter is successfully started, and the problem is perfectly solved.

 
The above is the whole content of this chapter. Welcome to WeChat official account of the three shopkeeper, “program ape by three shopkeeper”, three shopkeeper’s Sina micro-blog “three shopkeeper 666”, welcome to pay attention!

Three WeChat’s official account:

Sina Weibo of three shopkeepers:

 


Read More: