如何解决ERROR.Failed to parse XML in AndroidManifest.xml in Flutter的问题?在Flutter中解析AndroidManifest.xml中的X

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何解决ERROR.Failed to parse XML in AndroidManifest.xml in Flutter的问题?在Flutter中解析AndroidManifest.xml中的X相关的知识,希望对你有一定的参考价值。

我尝试了一些方法,如删除标签,添加taga等,但我仍然在androidManifest.xml文件中得到这个错误。

ERROR.解析E:flutter_Apps/flutter_app_dont_stare_v2android/appsrc/main/AndroidManifest.xmlPar的XML时失败。Failed to parse XML in E:flutter_Appsflutter_app_dont_stare_v2androidappsrcmain/AndroidManifest.xmlParseError at [row,col]:[23,35]Message: expected start or end tagAffected Modules: app

错误的形象

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.flutterappdontstarev2"
    tools:ignore="ExtraText">
    <!-- 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. -->

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.SET_ALARM" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application tools:ignore="ExtraText">
        android:name=".Application"
        android:label="Stare Away"
        android:icon="@mipmap/ic_launcher"

        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="wxxxxxxxxxxxxxxxxxxx1" />

        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

        <service
            android:name="io.flutter.plugins.androidalarmmanager.AlarmService"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE" />

        <receiver
            android:name="io.flutter.plugins.androidalarmmanager.AlarmBroadcastReceiver"
            android:exported="false" />
        <receiver
            android:name="io.flutter.plugins.androidalarmmanager.RebootBroadcastReceiver"
            android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />


    </application>
</manifest>
答案

移除 > 在第20行结尾处,将 "我 "改为 "我"。/> 在第25行末尾改为 >

所以Xml可以有效

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.flutterappdontstarev2"
    tools:ignore="ExtraText">
    <!-- 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. -->

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.SET_ALARM"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.VIBRATE"/>

    <application
        tools:ignore="ExtraText"
        android:name=".Application"
        android:label="Stare Away"
        android:icon="@mipmap/ic_launcher">

        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"


        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

        <service
            android:name="io.flutter.plugins.androidalarmmanager.AlarmService"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE" />

        <receiver
            android:name="io.flutter.plugins.androidalarmmanager.AlarmBroadcastReceiver"
            android:exported="false" />
        <receiver
            android:name="io.flutter.plugins.androidalarmmanager.RebootBroadcastReceiver"
            android:enabled="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
    </application>
</manifest>

以上是关于如何解决ERROR.Failed to parse XML in AndroidManifest.xml in Flutter的问题?在Flutter中解析AndroidManifest.xml中的X的主要内容,如果未能解决你的问题,请参考以下文章

Failed to decode downloaded font和OTS parsing error: Failed to convert *** font to ***

github 如何解决error: failed to push some refs

如何解决:git push error: failed to push some refs to

如何解决git====push 过程中出现的。error: failed to push some refs

解决error: failed to push some refs to 'xxxx'

Git push 报错 "error: failed to push some refs to " 解决