我的android清单文件中有错误:
Error:Cannot read packageName from C:\Users\brandon\AndroidStudioProjects\MineDodge2\app\src\main\AndroidManifest.xml
Error:The markup in the document preceding the root element must be well-formed.
我试着在这个网站上看,但答案对我不起作用。
<?xml version="1.0" encoding="utf-8"?>
< manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.brandon.MineDodge" >
<application
android:allowBackup="true"
android:icon="@mipmap/redjet"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.brandon.MineDodge.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.brandon.MineDodge.Splash" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</application>
</manifest>
发布于 2016-02-25 01:27:00
这个错误真的很简单,我对堆栈社区直到现在还没有发现它感到相当失望。
< manifest ...
应该变成
<manifest...
基本上,删除多余的空间。这就是导致以下错误的原因:
Error:The markup in the document preceding the root element must be well-formed.
同样,用于MainActivity的意图过滤器也必须类似地用于第二个活动。
希望这个问题得到解决。
发布于 2018-07-08 06:24:36
我在Unity 2018上发现了这个错误,我认为这是一个bug。
修复:将packagename添加到Unity项目中的Android Manifest中。
在我的项目路径清单中:Assets/Plugins/Android/AndroidManifest.xml
例如,当我的清单文件看起来像这样时,我得到了错误:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
</manifest>
它是由Unity的Oculus Gear VR插件生成的。但是它没有包名,必须看起来像这样:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest package="YOURPACKAGENAME" xmlns:android="http://schemas.android.com/apk/res/android">
...
</manifest>
将YOURPACKAGENAME替换为项目的包名。它应位于编辑->项目设置-> Player ->其他设置->标识->包名称中,并且应类似于com.YOURORGANIZATION.APPNAME
有些人写道,清单必须看起来像这样:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest package="${applicationId}" xmlns:android="http://schemas.android.com/apk/res/android">
...
</manifest>
他们写道,在构建安卓应用时,Unity将在包名上替换${applicationId}
,但在我的Unity 2018.1.6f1中,它不能工作,我认为这也是一个错误。
发布于 2015-09-08 10:28:16
此处不允许您的第二个<action android:name="android.intent.action.MAIN" />
和<category android:name="android.intent.category.LAUNCHER" />
。我认为`<清单xmlns:android="http://schemas.android.com/apk/res/android“package="com.example.brandon.MineDodge”>
<application
android:allowBackup="true"
android:icon="@mipmap/redjet"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.brandon.MineDodge.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.brandon.MineDodge.Splash" />
</application>
‘那会很好的。
https://stackoverflow.com/questions/32447683
复制相似问题