Crash with BluetoothLE and micro:bit on Android 14

I am a novice with App Inventor, trying to use Bluetooth with micro:bit.

The examples I have tried seem to work on my Android 12 phone, but crash soon after connecting on my Android 14 Samsung SM-X200 tablet.

To be specific, I have tested the Data Collector sample mentioned here

I have tried upgrading the BluetoothLE extension to 20240322-beta2

I have used both the release website and https://sdk34-dot-ai2-ewpatton-temp.appspot.com/

With an APK from the SDK 34 technical preview, I captured this:

Data_Collector_STARTER E FATAL EXCEPTION: main
Process: appinventor.ai_xxxxxxxxxxxxxx.Data_Collector_STARTER, PID: 20544
java.lang.ExceptionInInitializerError
at edu.mit.appinventor.ble.BluetoothLEint$BLEReadOperation.subscribe(BluetoothLEint.java:357)
at edu.mit.appinventor.ble.BluetoothLEint$BLEReadOperation.run(BluetoothLEint.java:325)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8913)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.IllegalArgumentException: UUID string too large
at java.util.UUID.fromStringJava11(UUID.java:238)
at java.util.UUID.fromString(UUID.java:226)
at edu.mit.appinventor.ble.BluetoothLEGattAttributes.(BluetoothLEGattAttributes.java:33)
at edu.mit.appinventor.ble.BluetoothLEint$BLEReadOperation.subscribe(BluetoothLEint.java:357)
at edu.mit.appinventor.ble.BluetoothLEint$BLEReadOperation.run(BluetoothLEint.java:325)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8913)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

Interesting, I have an app (Bluetooth BLE) that was working fine with a build from few weeks ago. Today I made a small change in the screen, just a cosmetic.. and then the new build has the same error as you.
Caused by: java.lang.IllegalArgumentException: UUID string too large

This error started with the today build, the old apk still working.

This is the log:

AndroidRuntime: FATAL EXCEPTION: main
AndroidRuntime: Process: appinventor.ai_hsduuda.MeshTech_Reel, PID: 20159
AndroidRuntime: java.lang.ExceptionInInitializerError
AndroidRuntime: at edu.mit.appinventor.ble.BluetoothLEint$BLEReadOperation.subscribe(BluetoothLEint.java:357)
AndroidRuntime: at edu.mit.appinventor.ble.BluetoothLEint$BLEReadOperation.run(BluetoothLEint.java:325)
AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:958)
AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:230)
AndroidRuntime: at android.os.Looper.loop(Looper.java:319)
AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8919)
AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
AndroidRuntime: Caused by: java.lang.IllegalArgumentException: UUID string too large
AndroidRuntime: at java.util.UUID.fromStringJava11(UUID.java:238)
AndroidRuntime: at java.util.UUID.fromString(UUID.java:226)
AndroidRuntime: at edu.mit.appinventor.ble.BluetoothLEGattAttributes.(BluetoothLEGattAttributes.java:33)

@ABG
In my other thread, I spoke too soon. With the newer BLE extension, it does connect without issue now and builds without issue now, but like the other 2 gentlemen above, if I attempt to register for anything, the app immediately crashes.
If you recall from our conversation the other night, it was crashing immediately on connect with the older BLE extension version. With the newest one, 202403322, it connects but the moment it tries to register, that's when the crash occurs.
Can you confirm?

Thanks for the report. This appears to be due to a semantic change between Java 8 and 11 around UUIDs that went into affect starting with Android 14. I'll look at updating the BLE extension to be more robust to the Java 11 constraints.

Thanks everyone! The reason for the crash wasn't at all what I expected, so it's a relief to know it's not just me, and even better that you understand the probable cause!

Thank you! Not holding you to anything, but do you have any thoughts or estimates around time to resolve? Just want to get a ballpark if possible.

I'm on my way home from the office, so I haven't had a chance to test this yet, but here's an updated BLE extension that may fix the issue.

edu.mit.appinventor.ble.aix (204.9 KB)

(added to FAQ)

Awesome, thank you both! Im out of the office today, but i will update and test either late this evening EST or tomorrow morning.

Thanks for the update, It works. :100:

1 Like

Works for me too. Many thanks!

This new BLE extension also solved my problems with running the app. Great. Thanks Evan

Hello I update to BLE Date Built 2024-08-22
With Android 10, Connect With MAC ok

but not connect with
Android 11 Moto G8 Compilation RPJS31.Q4U-47-35-17
nor
Android 14 Moto G54 5G Compilation U1TDS34.94-12-7-6

Tks
BLE_TEST_ONLY_03.aia (230.6 KB)

Hi Anke,
Android 10 API 29 Moto g(8) play Connected
Android 11 API 30 Moto g8 No Connect
Android 13 API 33 Moto g13 Connected
Android 14 API 34 Moto g54 5G No Connect


I disable Bluetooth in the smart fones, enabled and all working now,

Tks and sorry for your time !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.