更改了包名,现在AndroidManifest.xml不起作用

时间:2016-04-07 21:15:40

标签: java android eclipse

所以,我试图通过我在StackOverflow网站上其他地方找到的以下步骤来更改包:

  1. 创建新包
  2. 将包折射到新包
  3. 更改AndroidManifest.xml表单中的包装行 顺便说一句,如果相关的话,我会使用Eclipse。
  4. 但是,我在AndroidManifext.xml文件中收到错误消息:

    Parser exception for /GameProj/AndroidManifest.xml: The prefix "com.p.gameproj.Dataid" for attribute "com.p.gameproj.Dataid:name" associated with an element type "activity" is not bound At line 31. 
    

    有人能告诉我错误信息的含义吗?

    此外,这里是AndroidManifest.xml文件,如果它相关:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.p.gameproj"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="21" />
    
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.p.gameproj.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity
                com.p.gameproj.Creditsname=".Credits"
                android:label="@string/title_activity_credits" >
            </activity>
            <activity
                com.p.gameproj.Dataid:name=".Data"
                android:label="@string/title_activity_data" >
            </activity>
            <activitycom.p.gameproj.CharacterPageandroid:name=".CharacterPage"
                android:label="@string/title_activity_character_page" >
            </activity>
            <activity
                com.p.gameproj.StatPageame=".StatPage"
                android:label="@string/title_activity_stat_page" >
            </activity>
            <activitycom.p.gameproj.MapMain      android:name=".MapMain"
                android:label="@string/title_activity_map_main" >
            </activity>
       com.p.gameproj.ScreenLocvity
                android:name=".ScreenLoc"
                android:label="@string/title_activity_screen_loc"com.p.gameproj.BattleScreen/activity>
            <activity
                android:name=".BattleScreen"
                android:label="@string/title_activity_battle_screen" >
            </com.p.gameproj.InvScreen
            <activity
                android:name=".InvScreen"
                android:label="@string/title_activity_inv_screen"com.p.gameproj.ShopThing  </activity>
            <activity
                android:name=".ShopThing"
                android:label="@string/title_activity_shop_thing" >
            </activity>
        </application>
    
    </manifest>
    

1 个答案:

答案 0 :(得分:3)

在更改包名称时看起来出了问题。可能是一个糟糕的发现/替换行动。 AndroidManifest.xml文件中有几个无效的属性和元素,如下所示:

<activity
    com.p.gameproj.Dataid:name=".Data"
    android:label="@string/title_activity_data" >

注意com.p.gameproj.Dataid:name=".Data"。它应该是android:name=".Data"

一旦你修复了所有这些错误值,它就应该再次起作用。

这应该很接近

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.p.gameproj"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.p.gameproj.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Credits"
            android:label="@string/title_activity_credits" >
        </activity>
        <activity
            android:name=".Data"
            android:label="@string/title_activity_data" >
        </activity>
        <activity
            android:name=".CharacterPage"
            android:label="@string/title_activity_character_page" >
        </activity>
        <activity
            android:name=".StatPage"
            android:label="@string/title_activity_stat_page" >
        </activity>
        <activity
            android:name=".MapMain"
            android:label="@string/title_activity_map_main" >
        </activity>
        <activity
            android:name=".ScreenLoc"
            android:label="@string/title_activity_screen_loc">
        </activity>
        <activity
            android:name=".BattleScreen"
            android:label="@string/title_activity_battle_screen" >
        </activity>
        <activity
            android:name=".InvScreen"
            android:label="@string/title_activity_inv_screen">
        </activity>
        <activity
            android:name=".ShopThing"
            android:label="@string/title_activity_shop_thing" >
        </activity>
    </application>
</manifest>