“标签<活动>属性名称包含无效字符''。 " Android Manifest [英] "Tag <Activity > attribute name has invalid character ' '. " Android Manifest

查看:237
本文介绍了“标签<活动>属性名称包含无效字符''。 " Android Manifest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android Manifest中收到错误Tag属性名称有无效字符'。,而没有明显无效的字符。这是代码:

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>

如您所见,代码中没有''字符。有谁知道为什么会这样?需要注意的一点是,我使用Eclipse控制台内部运行的几行Java生成了这段代码。代码是:

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++;
    }


推荐答案

android:name 应该引用代表活动的类路径。它不得包含任何特殊字符或空格。

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

例如:

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

这里, MainActivity 是扩展活动的类文件。

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

这篇关于“标签&lt;活动&gt;属性名称包含无效字符''。 &QUOT; Android Manifest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆