Android Question manifest edit with USB_ACCESSORY_ATTACHED

giga

Well-Known Member
Licensed User
Longtime User
I am trying to attach an accessory to android using but the manifest comes back with an error

"Parsing code. 0.02
Compiling code. 0.02
Compiling layouts code. 0.00
Generating R file. Error
AndroidManifest.xml:42: error: Error parsing XML: mismatched tag"

This is a copy of the manifest, also
I am using USB_ACCESSORY_ATTACHED not USB_DEVICE_ATTACHED

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.usb.accessory" />)
AddActivityText(main, <intent-filter>
<activity android:name=".UsbAccessoryActivity" android:label="@string/test">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

Any help always appreciated...
Thank you.
 

floatingpoint

Member
Licensed User
Longtime User
I am trying to attach an accessory to android using but the manifest comes back with an error

"Parsing code. 0.02
Compiling code. 0.02
Compiling layouts code. 0.00
Generating R file. Error
AndroidManifest.xml:42: error: Error parsing XML: mismatched tag"

This is a copy of the manifest, also
I am using USB_ACCESSORY_ATTACHED not USB_DEVICE_ATTACHED

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.usb.accessory" />)
AddActivityText(main, <intent-filter>
<activity android:name=".UsbAccessoryActivity" android:label="@string/test">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

Any help always appreciated...
Thank you.


giga,

With help from others i have just got a USB Accessory working with this manifest:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<uses-feature android:name="android.hardware.usb.accessory"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
AddActivityText(main, <intent-filter>
        <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
    </intent-filter>
  <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
        android:resource="@xml/accessory_filter" />)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

Hope this helps.

FP
 
Upvote 0
Top