How can I get the ADK DemoKit example working on a Google I/O Galaxy Tab 10.1?

后端 未结 4 1219
迷失自我
迷失自我 2020-12-16 07:05

I\'m trying to get the DemoKit example working on an ADK board. It seems like even with the 3.1 update the Galaxy Tab doesn\'t have everything it needs (or at least doesn\'t

4条回答
  •  佛祖请我去吃肉
    2020-12-16 07:23

    My Galaxy Tab 10.1 on Android 3.1 didn't have the accessories API as a backport as well. So I got the following exception as well:

    java.lang.NoClassDefFoundError: com.android.future.usb.UsbManager
    

    One way to bringing it to work on the Tab 10.1 with Android 3.1 is to use the regular accessory API. Not the backported version. You can set your DemoKit projects target SDK to the regular API level 12 (Android 3.1).

    In addition you have to change the code passages in the DemoKitActivity to get the UsbManager and the UsbAccesory to:

    UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
    UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
    

    imports change to:

    import android.hardware.usb.UsbAccessory;
    import android.hardware.usb.UsbManager;
    

    The Android manifest can still contain the following entry but it is not required anymore:

    
    

提交回复
热议问题