简体   繁体   中英

The value of attribute “android:name” associated with an element type “null” must not contain the '<' character

Extreme novice here tying to figure this error out.

The value of attribute "android:name" associated with an element type "null" must not contain the '<' character

This is generated by something I have created with the addition of the android.hardware.usb.jar I have included as a library I believe. I can't identify what/which target is "null"

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

<uses-sdk
    android:minSdkVersion="12"
    android:targetSdkVersion="18" />

    <uses-feature
        android:name="android.hardware.usb/>

<application
        android:allowBackup="android:false" 
        android:icon="@drawable/ic_launcher"                    
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        <uses-library android:name="android:android.hardware.usb" />
        <android-required ="android:true " />
        <activity android:name="com.nitro.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" 

            <intent-filter
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER />
            </intent-filter>

            <intent-filter
                <action         android:name="android:android.hardware.usb.action.USB_DEVICE_ATTACHED " />
            </intent-filter>

           <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" 
                      android:resource="@xml/acccessory_filter" />

        </activity>

    </application>

</manifest>

I am still building and learning. This is just a hobby at this point so go easy on me, this is all out of my comfort zone and I will need detailed explanation.

Thanks Kyle

  <uses-feature
        android:name="android.hardware.usb/>

You haven't closed the quote, it should be:

<uses-feature
        android:name="android.hardware.usb" />

You have also forgotten to close this quote:

<category android:name="android.intent.category.LAUNCHER />

Should be

<category android:name="android.intent.category.LAUNCHER" />

Also, your application tag is not closed and android:false is not valid:

<application
        android:allowBackup="android:false" 
        android:icon="@drawable/ic_launcher"                    
        android:label="@string/app_name"
        android:theme="@style/AppTheme"

Should be

<application
        android:allowBackup="false" 
        android:icon="@drawable/ic_launcher"                    
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

That is not correct:

    <uses-library android:name="android:android.hardware.usb" />
    <android-required ="android:true " />

As there is no standalone android-required tag, that is probably the android:required of the uses-library tag. Here you can read more on that. It should be like:

<uses-library android:name="android:android.hardware.usb" android:required ="true" />

Your intent-filter tag is not closed:

<intent-filter

It should be:

<intent-filter>

The whole manifest with all fixed bugs should be like this I believe:

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

    <uses-sdk
        android:minSdkVersion="12"
        android:targetSdkVersion="18" />

    <uses-feature android:name="android.hardware.usb" />

    <application
        android:allowBackup="false"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <uses-library
            android:name="android:android.hardware.usb"
            android:required="true" />

        <activity
            android:name="com.nitro.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android:android.hardware.usb.action.USB_DEVICE_ATTACHED " />
            </intent-filter>

            <meta-data
                android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
                android:resource="@xml/acccessory_filter" />
        </activity>
    </application>

</manifest>

I had the same error and checked the exact text and it was ok but still THE ERROR...

So I fixed copy pasting that line of the manifest (uses-sdk) from another Manifest of a working project and build it nicely!

Hope it helps!

   android:name="android.hardware.usb/>need closing quote

   android:name="android.hardware.usb"/>

here try this

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nitro"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="12"
    android:targetSdkVersion="18" />

    <uses-feature
        android:name="android.hardware.usb"/>

<application
        android:allowBackup="android:false" 
        android:icon="@drawable/ic_launcher"                    
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <uses-library android:name="android:android.hardware.usb" />
        <android-required ="android:true " />
        <activity android:name="com.nitro.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER />
            </intent-filter>

            <intent-filter>
                <action         android:name="android:android.hardware.usb.action.USB_DEVICE_ATTACHED " />
            </intent-filter>

           <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" 
                      android:resource="@xml/acccessory_filter" />

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