Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Tag <Activity > attribute name has invalid character ' '. " Android Manifest

I am getting the error "Tag attribute name has invalid character ' '. " in the Android Manifest, while there is no obviously invalid character. Here is the code:

<activity
        android:name="Quiz 31"
        android:configChanges="orientation|keyboardHidden"
        android:label="Quiz 31"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter>
            <action android:name="com.SoulSlayerAbad.AMQ.QUIZ31" />

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

As you can see, no ' ' character in the code. Does anyone know why this is happening? One thing to note is that I generated this piece of code using a few lines of Java run inside of Eclipse console. The code for that is:

        int Begin = 0, End = 0; 
    Scanner sc = new Scanner(System.in);

    String Text = " <activity "+
            "android:name=\"Quiz "+Begin+"\" "+
            "android:configChanges=\"orientation|keyboardHidden\" "+
            "android:label=\"Quiz "+Begin+"\" "+
            "android:screenOrientation=\"portrait\" "+
            "android:theme=\"@android:style/Theme.NoTitleBar\" > "+
            "<intent-filter> "+
                "<action android:name=\"com.SoulSlayerAbad.AMQ.QUIZ"+Begin+"\" /> "+

                "<category android:name=\"android.intent.category.DEFAULT\" /> "+
            "</intent-filter> "+
        "</activity> ";

    System.out.println("Begining:");
    Begin = sc.nextInt();
    System.out.println("End At:");
    End = sc.nextInt();
    while(Begin <= End){
        System.out.println(Text);
        Begin++;
    }
like image 417
AbdulRehman Avatar asked Mar 11 '14 18:03

AbdulRehman


1 Answers

android:name is supposed to have reference of your class path which represents the activity. It must not contain any special characters or spaces.

For example:

android:name="com.json.test.MainActivity"

Here, MainActivity is the class file which extends an Activity.

like image 51
waqaslam Avatar answered Oct 08 '22 20:10

waqaslam