本文介绍了在三星Galaxy S2的Andr​​oid USB附件API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法启动我的android应用到三星Galaxy S2。我想使用谷歌添加上图书馆USB配件。当我启动对谷歌Nexsus S中的同一个应用程序,它工作正常。

I am not able to launch my android application on to the Samsung Galaxy S2. I am trying to use the Google Add on Library for USB Accessory. When I launch the same application on Google Nexsus S it works fine.

在应用程序清单文件我已经使用了以下标记(应用程序标记下):

In the application manifest file I have used the following tag (under the application tag):

<uses-library android:name="com.android.future.usb.accessory"/>

这是我收到的控制台上的错误是

The error that i am getting on the console is

[2011-08-11 12:00:28 - App] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2011-08-11 12:00:28 - App] Please check logcat output for more details.
[2011-08-11 12:00:29 - App] Launch canceled!

现在,如果我省略清单下面一行:

Now if I omit the following line from manifest:

<uses-library android:name="com.android.future.usb.accessory"/>

我得到LogCat中出现以下错误:

I get the following error on LogCat:

08-11 11:58:40.250: ERROR/AndroidRuntime(30780): java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager

任何想法来克服这个问题?

Any ideas to get round this problem?

我的目标是使用USB主机(或至少使用USB附件API)上的GALAXY S2。

My goal is to use the USB host (or at least use the USB Accessory API) on Galaxy S2.

推荐答案

我解决这个问题。

我们只需要按下一个XML文件中插入设备的在/ etc /权限的文件夹。

We just need to push one xml file into the device's "/etc/permissions" folder.

android.hardware.usb.accessory.xml与内容

android.hardware.usb.accessory.xml with the content

<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <feature name="android.hardware.usb.accessory" />
    <library name="com.android.future.usb.accessory"
           file="/system/framework/com.android.future.usb.accessory.jar" />
</permissions>

如果您收到了只读文件系统的错误。那么你需要以root您的设备是这样的。

If you are getting the "read only file system" error. then you need to root your device like this.

所有的重新启动后。这将正常工作。

After all reboot. It will work fine.

这篇关于在三星Galaxy S2的Andr​​oid USB附件API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 23:09