USB Accessory API on Samsung Galaxy S2 Android

旧时模样 提交于 2019-11-27 15:04:47

问题


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

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?

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


回答1:


I got solution to this problem.

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

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>

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.




回答2:


I have my Samsung Galaxy S II and I can run the applications there without any problems.

You mean to run your applications in "debugg-mode" from the Eclipse? Or you mean to create the .apk and after to install it on your phone?

If it is to run it directly from your Eclipse to your phone, you have to know that first of all, it is neccesary to have the Samsung Drivers installed on the computer, I recommend you to install Samsung kies. Download Samsung Kies

After you install the drivers and so on, remember you have to click on "debug mode" on your phone. It is on "preferences->Applications->development->Usb Debugging




回答3:


I have Samsung Galexy SII. I am facing the same problem before couple of days. Not can able to run my Android Apps in to SII and it works fine. There are no any issue like required shared library or anything else.

Sollution of that Issue:

I just have install the Samsung Kies from here.

Then restart both, Device and PC. and then turn on the USB debugging in to device.

Now connect your Mobile with the PC and then try.

It will surly works.

Enjoy. :)




回答4:


update your Android version 2.3.4,,



来源:https://stackoverflow.com/questions/7024801/usb-accessory-api-on-samsung-galaxy-s2-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!