java.lang.NoClassDefFoundError: android.bluetooth.BluetoothManager

I follow the instructions in https://wiki.libsdl.org/Android using androidbuild.sh with test/testgles.c and it was built and installed successfully to Android phone 4.1.2 (Jelly Bean API 16) but it crashed with message:

E/AndroidRuntime: FATAL EXCEPTION: SDLActivity
java.lang.NoClassDefFoundError: android.bluetooth.BluetoothManager

I’ve found similar issue here https://stackoverflow.com/q/34314408 seems like Bluetooth supports in only available for API >= 18? How to run SDL on phone with API < 18 as I don’t really need gamepad supports though?

Thanks in advance! :slight_smile:

1 Like

Hi Pixel,

Did you ever resolve this issue? It just happened to me recently and it seems to be caused by the introduction of the following line in AndroidManifest.xml :

<uses-permission android:name="android.permission.BLUETOOTH" />

I remove it and it works, this line was added recently and because it breaks early API levels, it’s probably a bug.

1 Like

@AntTheAlchemist, I’m happy to say that your workaround works for me, but shouldn’t SDL detect the API version and automatically disable BluetoothManager in versions of Android that don’t support it? Android had support for Bluetooth before API version 18! Turning off Bluetooth won’t work for people that actually want to use it.

I opened a bug report (I also included a patch to disable Bluetooth on old versions of Android): https://bugzilla.libsdl.org/show_bug.cgi?id=5450

1 Like