Closed link2xt closed 3 months ago
Could you provide more information?
Have you tried install the app via Google Play store?
It is Android 10 on Xiaomi Redmi Note 3 (codename kenzo
). I only tried the APK from the website so far, could try to download Google Play version via Aurora Store, but don't have actual Google Play account.
Maybe you need to reduce targetSdk? I don't see it set anywhere in https://github.com/qaul/qaul.net/blob/5385e61de5a63201e11e4be34ba3cd28be1c6ea9/qaul_ui/android/build.gradle
Aurora Store currently does not work for me, so I cannot test the version from Google Play.
Aurora Store currently does not work for me, so I cannot test the version from Google Play.
You can also get it from Apkpure: https://apkpure.com/qaul-%D9%82%D9%88%D9%84/net.qaul.qaul_app
I have downloaded 2.0.0-beta.17 from https://github.com/qaul/qaul.net/releases/tag/v2.0.0-beta.17 and installed it with adb install qaul-2.0.0-beta.17.apk
over USB.
If I start the app without enabling bluetooth and do not enable it when it says "qaul wants to turn on Bluetooth" (click "Deny"), it works. But if I click "Allow" and bluetooth gets enabled, after "Turning on Bluetooth..." popup it crashes.
Crash log from adb logcat
:
03-25 02:56:56.835 29022 31329 I libqaul::connections:..: BLE module start result received
03-25 02:56:56.835 29022 31329 I libqaul::connections:..: BLE Module successfully started
03-25 02:56:56.841 30700 30716 E Parcel : Attempt to read from protected data in Parcel 0x6fd0427a68
03-25 02:56:56.843 29022 31351 E AndroidRuntime: FATAL EXCEPTION: pool-5-thread-1
03-25 02:56:56.843 29022 31351 E AndroidRuntime: Process: net.qaul.qaul_app, PID: 29022
03-25 02:56:56.843 29022 31351 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.IBinder android.os.IInterface.asBinder()' on a null object reference
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:2077)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:2039)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:1987)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.bluetooth.IBluetoothGatt$Stub$Proxy.startAdvertisingSet(IBluetoothGatt.java:1526)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.bluetooth.le.BluetoothLeAdvertiser.startAdvertisingSet(BluetoothLeAdvertiser.java:434)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.bluetooth.le.BluetoothLeAdvertiser.startAdvertisingSet(BluetoothLeAdvertiser.java:306)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.bluetooth.le.BluetoothLeAdvertiser.startAdvertising(BluetoothLeAdvertiser.java:158)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at android.bluetooth.le.BluetoothLeAdvertiser.startAdvertising(BluetoothLeAdvertiser.java:93)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at net.qaul.ble.service.BleService.startAdvertise$lambda-1(BleService.kt:47)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at net.qaul.ble.service.BleService.e(Unknown Source:0)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at c7.b.run(Unknown Source:4)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
03-25 02:56:56.843 29022 31351 E AndroidRuntime: at java.lang.Thread.run(Thread.java:919)
I have built the app myself and got the same crash. Made workaround #616.
Some other interesting output from the log:
03-25 02:54:06.740 1549 1823 D BluetoothManagerService: MESSAGE_REGISTER_ADAPTER
03-25 02:54:06.753 1010 30589 I libqaul::connections:..: =========================
03-25 02:54:06.753 1010 30589 I libqaul::connections:..: BLE info received
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: -------------------------
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: This Devices ID
...
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: -------------------------
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: BLE Supported: true
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: ID:
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: Name: f3flA
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: Bluetooth Enabled: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: Advertisement Extended: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: 2M supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: LE coded supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: LE audio supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: LE periodic advertisement supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: LE multiple advertisement supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: offload filter supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: offload scan batching supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: =========================
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: BLE send start request
Could be this is the reason startAdvertising
does not work?
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: LE periodic advertisement supported: false
03-25 02:54:06.754 1010 30589 I libqaul::connections:..: LE multiple advertisement supported: false
EDIT: seems we are not using PeriodicAdvertisingParameters, so should not be the issue.
Maybe we should not try to setup bluetooth LE advertising if it is not supported?
Documentation for reference: https://source.android.com/docs/core/connect/bluetooth/ble_advertising
Maybe use startAdvertisingSet
directly as example shows, instead of calling startAdvertising
which then fails?
Another example uses startAdvertising
:
https://github.com/android/connectivity-samples/blob/777517eb2898cd48e139446246808a2106d343cc/BluetoothAdvertisementsKotlin/app/src/main/java/com/example/bluetoothadvertisements/service/AdvertiserService.kt
They handle it as error if multiple advertisement is not supported:
https://github.com/android/connectivity-samples/blob/777517eb2898cd48e139446246808a2106d343cc/BluetoothAdvertisementsKotlin/app/src/main/java/com/example/bluetoothadvertisements/MainActivity.kt#L59-L60
I also found someone reporting similar stacktrace on different phones: https://gitlab.com/LineageOS/issues/android/-/issues/2205
There an app calls startAdvertisingSet
directly, so using it without startAdvertising
likely does not help.
qaul uses normal BLE advertising, which BLE standard and every device must support it. IMHO the failure of being able to advertise on BLE is a vendor/manufacturer bug, which cannot be fixed on application level, only mitigated as you did in #616 (thanks for that!).
It should probably be more visible in the UI that BLE initialization failed, but closing this once there is a version that does not crash is also fine.
fixed by #616
Still a TODO is a user information about the state and the possibilities of the BLE interface.
By the way Briar works over bluetooth on the same phone. I have tested with Wi-Fi disabled, no internet connectivity possible, and in Briar itself I also disabled everything but bluetooth. So maybe reopen this issue and try to copy what Briar does?
Briar requires scanning the QR code so maybe it does not do "advertising". But better look into the code.
I installed https://github.com/qaul/qaul.net/releases/download/v2.0.0-beta.16/qaul-2.0.0-beta.16.apk from the website.
The application keeps crashing before showing any UI.
adb logcat output: