简体   繁体   中英

changed package name, now AndroidManifest.xml doesn't work

So, I tried to change the package by the following steps I found elsewhere on StackOverflow website:

  1. create a new package
  2. refractor the package to the new package
  3. changing the package line in the form for the AndroidManifest.xml btw I'm using Eclipse, if that's relevant.

However, I'm getting an error message in the AndroidManifext.xml file:

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. 

Can someone tell me what the error message means?

Also, here's the AndroidManifest.xml file, if it's relevant:

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

Looks like something went wrong during your package name change. Probably a bad find/replace action. There are a several invalid attributes and elements in the AndroidManifest.xml file such as the following:

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

Notice the com.p.gameproj.Dataid:name=".Data" . It should be android:name=".Data" .

Once you fix all these bad values it should work again.

This should be close

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM