문제

I'm programming android adk program (http://developer.android.com/guide/topics/usb/adk.html) on Samsung galaxy tab 10.1 (version 3.2). I have managed to get it working on simulator by using Google API level 12, but not on actual device.

Here is my DemoKit program.

When I run it on galaxy tab, "force to close" error and I have some error on LogCat during downloading and installing DemoKit.apk. I do not know about LogCat so I have attached LogCat file as reference to detect error. (LogCat file for problem DemoKit program)

Thanks in advance,
pak

도움이 되었습니까?

해결책

The Problem(atleast one) is that you are using the wrong USB library. The one you are using can only be used with Android 2.3.4+ for 3.1+ you have to use another one.

You have to change your imports from

com.android.future.usb

to

android.hardware.usb

then you need to change your the way you obtain the UsbManager Object from

UsbManager manager = UsbManager.getInstance(this);

to

UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);

and finally the way you obtain the intent from

UsbAccessory accessory = UsbManager.getAccessory(intent);

to

UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);

edit: more information can be found here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top