Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Using Bluetooth with Qt 5.3.1 on Android crashes with "invalid indirect reference"
I just started doing a few tests using Bluetooth on an Android device. As soon as I try to use the Qt Bluetooth API the application will crash with the following info:
@W/dalvikvm(23855): Invalid indirect reference 0x40ef24e8 in decodeIndirectRef
E/dalvikvm(23855): VM aborting
F/libc (23855): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1)@
I'm using a Qt 5.3.1, Android 4.0.3 ABI: armeabi-v7a, HTC Sensation.
Here is what try:
QList<QBluetoothHostInfo> localAdapters; //when reaching this line the app crashes localAdapters = QBluetoothLocalDevice::allDevices();
The same happens if I run the availble Bluetooth Examples.
Any ideas what the problem could be? Thanks!
It's working in my computer. I tried both my own application and example one. Which OS are you using in your computer? I tried in linux
try this for device connection:
void TestBluetooth():: test ()
QBluetoothDeviceDiscoveryAgent *qbd = new QBluetoothDeviceDiscovery(this)
connect (qdb, SIGNAL (deviceDiscovered(QBluetoothDeviceInfo)),this,SLOT (testing(QBluetoothDeviceInfo)));
void TestBluetooth()::testing (const QBluetoothDeviceInfo &dvc)
qdebug() <<"device is:" <<dvc.name();
Thanks optimusprime. I'm using linux also. When trying:
QBluetoothDeviceDiscoveryAgent *qbd = new QBluetoothDeviceDiscoveryAgent(this); connect(qbd,SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), this, SLOT(test(QBluetoothDeviceInfo))); qDebug() << "Starting discovery ..."; //here it prints the message, that the device does not support bluetooth qbd->start();
It reports, that the device does not support Bluetooth:
@W/Qt (14722): qbluetoothdevicediscoveryagent_android.cpp:98 (void QBluetoothDeviceDiscoveryAgentPrivate::start()): qt.bluetooth.android: Device does not support Bluetooth
I'm wondering if the Android version 4.0.3 may be too old?
I'm using JDK 1.8.0_05, android-ndk-r9d, android-sdk-linux-r23.0.2, AVD Target API 15
I think your problem is java version.
you should use jdk 1.6 version or 1.7 .
Try with 1.6 version, it should work.
look over this document. This blog is posted by BogDan Vatra, one who make possible android app with Qt
No, that wasn't it either. I tried jdk 1.6 and 1.7 without luck :(. Anyway, thanks again for looking into this.
Report your issue to developer..