问题
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
回答1:
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
来源:https://stackoverflow.com/questions/9338631/android-adk-error-on-galaxy-tab-10-1