【问题标题】:Error parsing LocalFile: 'E:\android\app\src\main\AndroidManifest.xml' Please ensure that the android manifest is a valid XML document and try again解析 LocalFile 时出错:'E:\android\app\src\main\AndroidManifest.xml' 请确保 android 清单是有效的 XML 文档,然后重试
【发布时间】:2021-03-16 17:13:00
【问题描述】:

我的应用程序运行良好。但是当我为互联网和地图添加一些使用权限以及为谷歌地图添加 api 密钥时,它给了我错误。我试过颤振干净,颤振运行,但仍然得到同样的错误。我不明白我在清单文件中做错了什么。请有人帮助我。

这是我的清单文件代码:

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

【问题讨论】:

  • 最后我没有看到清单 ( ) 的结束标记。没有它,XML 是无效的。请检查,如果您只是将错误复制粘贴到 SO,请更新问题。
  • 对不起,我只是复制粘贴错了
  • 没问题,我已经在下面发布了一个答案,希望它现在对你有用。
  • 对我来说,这是我在元标记周围放置的一些额外括号

标签: flutter google-maps dart android-manifest fluttermap


【解决方案1】:

你在android:icon="@mipmap/ic_launcher"之后缺少&gt;,所以应该是这样的:

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

<activity...

你的 IDE 应该给你提示,就像这样

如果您不使用 IDE,我强烈建议您开始使用 :)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-17
    相关资源
    最近更新 更多