我跟随本指南在API 10上使用com.android.future.usb库。
我做了以下工作:


manifest中<uses-feature android:name="android.hardware.usb.accessory" /> (直接子<manifest>)
<uses-library android:name="com.android.future.usb.accessory" /> (<application>之子)
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/accessory_filter" /> (第一activity之子)
res/xml/accessory_filter.xml,如提到的这里。通过这样做,我可以使用com.android.future.usb及其子类。但问题是,应用程序不会在manifest更改之后启动。
这是一个根设备,操作系统将此应用程序配置为在设备启动时自动启动。
我应该做任何其他的配置来使这个工作吗?也许应该在固件中做些什么?
编辑:
这是与usb相关的所有内容的logcat
USB mass storage support is not enabled in the kernerl
usb_configuration switch is not enabled in the kernerl
Volume usb state changing -1 (Initializing) -> 0 (No-Media)
Ignoring unknown switch 'usb_connected'
Package com.example.gui requires unavailable shared library com.android.future.usb.accessory: failing!
Skipping unknown volume '/mnt/usb'
USB Service
This kernel does not have USB configuration switch support发布于 2015-11-05 00:31:48
不清楚你所说的the application won't start是什么意思。
如果您期望应用程序启动automatically on device startup。这里有这样做的说明:如何在启动时启动应用程序?
如果问题是应用程序无法编译,则需要更多有关所遇到错误的信息。
您提到您根据所提供的链接对清单进行了更改。该示例还包括清单中活动元素的intent-filter标记,您没有提到这一点。因此,清单中的活动元素将有两个意图过滤器:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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>因此,您的应用程序没有启动可能是因为您从活动清单中删除了主/启动程序意图筛选器?
https://stackoverflow.com/questions/32962708
复制相似问题