Crash when using Bluetooth
Dominique Rety
dominiquerety at hotmail.fr
Wed Dec 26 17:33:18 UTC 2012
Hi Kate,
Thank you for your answer.
I tried some traces and modifications into the lib QtConnectivity without success. It seems to me that functions into the library already contain calls to JNIThreadHelper class that should setup the Java environment by performing jvm->AttachCurrentThread(), but this doesn't solve the problem.
At the same time, I performed some basic bluetooth tests directly through Java Eclipse (BluetoothAdapter.getDefaultAdapter.getName), which work fine on Nexus 7 with Android 4.2.
However, our project contains some legacy parts that have already been developed in C, and using Qt would be the very best way to integrate them. Therefore I will only envision to implement a direct bridge between Java and C parts as a last resort if I can't find a viable solution with Qt.
Consequently, I am very interested by your patches even before the next release, which could be helpful for us to take a decision for our development. Overriding and deploying the default Necessitas lib QtConnectivity is not a problem for me, at least for test purpose.
Regards,
Dominique
----- Original Message -----
From: Kate Alhola
To: Dominique Rety
Cc: <necessitas-devel at kde.org>
Sent: Wednesday, December 26, 2012 4:36 PM
Subject: Re: Crash when using Bluetooth
On 13.12.2012, at 16.41, Dominique Rety <dominiquerety at hotmail.fr> wrote:
Hi,
I am currently developing a telecommunication project involving Blutooth communication between Android devices. For this purpose, I'm trying to use Necessitas Bluetooth support and I experiment very similar problems that are described in the "Crash when using Bluetooth" (Kate Alhola) archive thread.
There is several issues in current necessitas libQtConnectivity version. I have hopefully fixed most of them and i have version of libQtConnectivity that least works with my own applocation. I try to deliver patches to necessitas project so that fixes could be included in next release.
Environment:
Java JDK 1.7.0_09
Qt Creator 2.5.83 Based on Qt 4.8.3 running on Linux Suze
Kit = Necessitas Qt 4.8.2 for Android armv7a
Compiler = Android GCC (arm-4.4.3)
Android target SDK = android-16
Deploy to Nexus 7 with Android version 4.2.
I firstly tried to deploy the btchat sample and I faced the same problem:
JNI ERROR (app bug): accessed stale local reference 0xe680001d (index 7 in a table of size 4)
VM aborting
Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 13965 (.example.btchat)
Setting traces in different source files of the connectivity library, I also noticed that the error happens when trying to use some member functions of QBluetoothLocalDevice (btchat sample requests for the local device name from the main function).
I tried to bypass this problem by only creating the QBluetoothLocalDevice without requesting for the device name in the btchat application. The program then starts correctly.
In the btchat application, the "Connect" button calls the QBluetoothServiceDiscoveryAgent::start function. This function randomly processes the request because it relies on discoveryState and deviceAddress members, which seem not to be initialized : either the discovery process freezes or the program aborts with an error (if luckily discoveryState and deviceAddress members get consistent values). I didn't try any further investigation. It seems to me that the connectivity library is compiled with qbluetoothlocaldevice_p.cpp, which just contains empty functions for the QBluetoothLocalDevice class, instead of a customized source for Android.
Yes, that's case. The QBluetoothLocalDevice initializes static handles to java virtual machine that are then referenced by other modules. I have made fixes to several parts of libQtConnectivity
Is Bluetooth support for Android in Necessitas complete ?
Most of, some functions are still missing but there are some bugs in current version
Is the btchat sample expected to work properly with Android ?
I have not tried that one
Is there any specific configuration issue I could miss ?
That's good question, what is origin of the bugs, does it work with older android
Versions ? The source reason of bugs is JNI handles alocation that conflict with
Current thread structure and some that handles are expired when used. I have only tested with
Android 4.x
Is there any corrective or complement software I could download ?
I could make my patches avaiable before next release but overriding default necessitas libQtConnectivity requires some tricks
How can I progress on this issue ? What is the best way to get help and advices ?
This list works fine.
Kate
Regards,
Dominique RETY
dominiquerety at hotmail.fr
_______________________________________________
Necessitas-devel mailing list
Necessitas-devel at kde.org
https://mail.kde.org/mailman/listinfo/necessitas-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/necessitas-devel/attachments/20121226/a2b03f60/attachment.html>
More information about the Necessitas-devel
mailing list