我的Android list 文件中有错误:

Error:Cannot read packageName from C:\Users\brandon\AndroidStudioProjects\MineDodge2\app\src\main\AndroidManifest.x‌​ml
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>

最佳答案

如果使用的是旧版本的 build.grade 文件,则应删除以下代码:

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        res.srcDirs = ['res']
    }
}

然后,“构建”>“清理项目”

注意:如果看到此代码,则说明您使用的是旧版本

07-24 09:49
查看更多