gpt4 book ai didi

android - XML解析错误(Android Studio)在哪里?

转载 作者:行者123 更新时间:2023-12-03 03:56:04 25 4
gpt4 key购买 nike

关闭。这个问题需要details or clarity .它目前不接受答案。












想改进这个问题?通过 editing this post 添加详细信息并澄清问题.

2年前关闭。




Improve this question




这个错误已经发生过几次,而且大多数时候它只是随着更新而消失。
当我尝试运行我的小应用程序时,Android Studio 说:
错误:无法解析 C:\Users...\AndroidStudioProjects\Getraenkerechner\app\src\main\AndroidManifest.xml 中的 XML
[row,col] 处的 ParseError:[14,16]
消息:预期的开始或结束标记
受影响的模块:app

这是 AndroidManifest 的内容:

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Support"
android:screenOrientation="portrait">
></activity>
<activity android:name=".WaterCalc"
android:screenOrientation="portrait">
></activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

知道问题可能是什么吗?
我尝试安装新的 gradle 版本,但没有帮助..

提前致谢...

最佳答案

我认为您缺少 manifest标签。当然不要忘记更改包名。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:versionCode="1"
android:versionName="1.0" >
<!-- put here the code you posted -->
</manifest>

要了解有关 Manifest 文件的更多信息,请阅读 doc .

在您的情况下,正确的 list 格式将是:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:versionCode="1"
android:versionName="1.0" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<activity android:name=".Support"
android:screenOrientation="portrait">
</activity>

<activity android:name=".WaterCalc"
android:screenOrientation="portrait">
</activity>

<activity
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>

关于android - XML解析错误(Android Studio)在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59619473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com