Bluetooth header file error on android



  • Hi,

    I made a desktop application using Bluetooth. However I am unable to build it for android
    I think the bluez is not present on Android.
    Can anyone tell me how to install bluez on android

    error: bluetooth/bluetooth.h: No such file or directory
    #include <bluetooth/bluetooth.h>
    ^

    Regards,
    Avtansh Sharma


  • Moderators

    @Avtansh-Sharma It should actually work. Can you show the whole error log?
    Are you using QtBluetooth or bluez directly?



  • I am using BLuez. It builds successfully as desktop application for linux but fails for android

    18:03:30: Running steps for project splinechart...
    18:03:30: Configuration unchanged, skipping qmake step.
    18:03:30: Starting: "/usr/bin/make"
    /home/user/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove --sysroot=/home/user/Android/Sdk/ndk-bundle/platforms/android-16/arch-arm/ -O2 -Os -mthumb -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../splinechart -I. -I../../../../5.9/android_armv7/include -I../../../../5.9/android_armv7/include/QtCharts -I../../../../5.9/android_armv7/include/QtWidgets -I../../../../5.9/android_armv7/include/QtGui -I../../../../5.9/android_armv7/include/QtSql -I../../../../5.9/android_armv7/include/QtCore -I. -isystem /home/user/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /home/user/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem /home/user/Android/Sdk/ndk-bundle/platforms/android-16/arch-arm/usr/include -I../../../../5.9/android_armv7/mkspecs/android-g++ -o devicedata.o ../splinechart/devicedata.cpp
    ../splinechart/devicedata.cpp:7:33: fatal error: bluetooth/bluetooth.h: No such file or directory
    #include <bluetooth/bluetooth.h>
    ^
    compilation terminated.

    Makefile:1211: recipe for target 'devicedata.o' failed
    make: *** [devicedata.o] Error 1
    18:03:31: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project splinechart (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.9.0 for Android armv7))
    When executing step "Make"
    18:03:31: Elapsed time: 00:00.


  • Moderators

    @Avtansh-Sharma If you're using bluez then this isn't a Qt issue and you're asking in the wrong forum.
    I don't know whether Android NDK contains bluez.



  • Hi,

    If i use QTBluetooth then would I require the ndk to have bluetooth libraries or QT framework will take care of it.


    Regards.
    Avtansh Sharma


  • Moderators

    @Avtansh-Sharma NDK contains everything Qt needs, at least it would be new to me that you would need to install something else.


  • Qt Champions 2016

    @Avtansh-Sharma said in Bluetooth header file error on android:

    Hi,

    If i use QTBluetooth then would I require the ndk to have bluetooth libraries or QT framework will take care of it.

    I only used Bluetooth LE yet and it works great on Android and iOS



  • @jsulm Google discontinued Bluez and is currently using Droid Bluetooth since the kitkat version



  • @ekkescorner I cannot use Bluetooth Le due to hardware restrictions


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.