Android ADK error on Galaxy Tab 10.1

…衆ロ難τιáo~ 提交于 2019-12-22 11:39:07

问题


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

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