Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

TeamSpeak on Qt android



  • I'm trying to use the TeamSpeak SDK for a personal project in Qt, it works fine on windows.
    now I try to compile it on android using .so lib that comes with TeamSpeak 3 SDK.
    I link the Lib as explain here.
    After that when i try to compile I get error : error: ld returned 1 exit status.
    this from compile output

    13:35:01: Running steps for project TeamSpeakTestYarb...
    13:35:01: Configuration unchanged, skipping qmake step.
    13:35:01: Starting: "C:\Qt\Qt5.6.1_Android\Tools\mingw492_32\bin\mingw32-make.exe" 
    C:\Qt\Qt5.6.1_Android\5.6\android_armv7\bin\qmake.exe -spec android-g++ -o Makefile ..\TeamSpeakTestYarb\TeamSpeakTestYarb.pro
    The system cannot find the path specified.
    C:\QTAndroid\android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ --sysroot=C:\QTAndroid\android-ndk-r12b/platforms/android-9/arch-arm/ -Wl,-soname,libTeamSpeakTestYarb.so -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libTeamSpeakTestYarb.so main.obj mainwindow.obj moc_mainwindow.obj   -LC:\QTAndroid\android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -LC:\QTAndroid\android-ndk-r12b/platforms/android-9/arch-arm//usr/lib -LC:/Qt/Qt5.6.1_Android/5.6/android_armv7/lib -lQt5Widgets -Lc:/utils/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a -Lc:/utils/android-ndk-r9c/platforms/android-9/arch-arm//usr/lib -lQt5Gui -lQt5Core -lGLESv2 -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc
    main.obj:main.cpp:function onServerTextMessageEvent(unsigned long long, unsigned short, char const*): error: undefined reference to 'ts3server_getClientVariableAsString'
    main.obj:main.cpp:function onServerTextMessageEvent(unsigned long long, unsigned short, char const*): error: undefined reference to 'ts3server_freeMemory'
    main.obj:main.cpp:function onClientConnected(unsigned long long, unsigned short, unsigned long long, unsigned int*): error: undefined reference to 'ts3server_getClientVariableAsString'
    main.obj:main.cpp:function onClientConnected(unsigned long long, unsigned short, unsigned long long, unsigned int*): error: undefined reference to 'ts3server_getGlobalErrorMessage'
    main.obj:main.cpp:function onClientConnected(unsigned long long, unsigned short, unsigned long long, unsigned int*): error: undefined reference to 'ts3server_freeMemory'
    main.obj:main.cpp:function onChannelTextMessageEvent(unsigned long long, unsigned short, unsigned long long, char const*): error: undefined reference to 'ts3server_getClientVariableAsString'
    main.obj:main.cpp:function onChannelTextMessageEvent(unsigned long long, unsigned short, unsigned long long, char const*): error: undefined reference to 'ts3server_getChannelVariableAsString'
    main.obj:main.cpp:function onChannelTextMessageEvent(unsigned long long, unsigned short, unsigned long long, char const*): error: undefined reference to 'ts3server_freeMemory'
    main.obj:main.cpp:function onChannelTextMessageEvent(unsigned long long, unsigned short, unsigned long long, char const*): error: undefined reference to 'ts3server_freeMemory'
    main.obj:main.cpp:function onAccountingErrorEvent(unsigned long long, unsigned int): error: undefined reference to 'ts3server_getGlobalErrorMessage'
    mainwindow.obj:mainwindow.cpp:function MainWindow::showChannels(unsigned long long): error: undefined reference to 'ts3server_getChannelList'
    mainwindow.obj:mainwindow.cpp:function MainWindow::showChannels(unsigned long long): error: undefined reference to 'ts3server_getChannelVariableAsString'
    mainwindow.obj:mainwindow.cpp:function MainWindow::createVirtualServer(char const*, int, unsigned int): error: undefined reference to 'ts3server_createVirtualServer'
    mainwindow.obj:mainwindow.cpp:function MainWindow::createVirtualServer(char const*, int, unsigned int): error: undefined reference to 'ts3server_getGlobalErrorMessage'
    mainwindow.obj:mainwindow.cpp:function MainWindow::createVirtualServer(char const*, int, unsigned int): error: undefined reference to 'ts3server_getVirtualServerKeyPair'
    mainwindow.obj:mainwindow.cpp:function MainWindow::createVirtualServer(char const*, int, unsigned int): error: undefined reference to 'ts3server_getGlobalErrorMessage'
    mainwindow.obj:mainwindow.cpp:function MainWindow::MainWindow(ServerLibFunctions, QWidget*): error: undefined reference to 'ts3server_initServerLib'
    mainwindow.obj:mainwindow.cpp:function MainWindow::MainWindow(ServerLibFunctions, QWidget*): error: undefined reference to 'ts3server_setVirtualServerVariableAsString'
    mainwindow.obj:mainwindow.cpp:function MainWindow::showClients(unsigned long long): error: undefined reference to 'ts3server_getClientList'
    mainwindow.obj:mainwindow.cpp:function MainWindow::showClients(unsigned long long): error: undefined reference to 'ts3server_getClientVariableAsString'
    collect2.exe: error: ld returned 1 exit status
    mingw32-make: *** [libTeamSpeakTestYarb.so] Error 1
    makefile:74: recipe for target 'libTeamSpeakTestYarb.so' failed
    13:35:02: The process "C:\Qt\Qt5.6.1_Android\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project TeamSpeakTestYarb (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.6.1))
    When executing step "Make"
    13:35:02: Elapsed time: 00:01.
    

    this my .pro file

    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    #CONFIG += console
    #CONFIG -= app_bundle
    #CONFIG -= qt
    
    TARGET = TeamSpeakTestYarb
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
            mainwindow.cpp
    
    HEADERS  += mainwindow.h
    
    FORMS    += mainwindow.ui
    
    #INCLUDEPATH += $$PWD/include
    #LIBS += $$PWD/lib/ts3server_win32.lib
    
    DISTFILES += \
        android/AndroidManifest.xml \
        android/gradle/wrapper/gradle-wrapper.jar \
        android/gradlew \
        android/res/values/libs.xml \
        android/build.gradle \
        android/gradle/wrapper/gradle-wrapper.properties \
        android/gradlew.bat \
        android/lib/libts3client_android.so # i add here too
    
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
    

    I need help to compile the TeamSpeak on android using Qt
    Thanks in advance



  • Judging by the name of your library you are trying to use a Windows library on Android.



  • but TeamSpeak supports Android and it's a cross platform the SDK folder I download contain a folder for android has this .so lib
    I think if I can link this lib to android it should work, is that right ? if so what I should do ?
    and Thanks for your reply


  • Lifetime Qt Champion

    Hi,

    You have to link you application against the android version of the library.



  • is .so file not the android lib for the TeamSpeak ? there're no other links on TeamSpeak website only this file for TeamSpeak SDK and contain folder have a .so lib for armav7 and x86 so i think if i link it it should work is that right ?


  • Lifetime Qt Champion

    From what I can see, you added the library to the list of files to deploy. However you're not linking to it i.e LIBS += -lts3client_android in and android scope.



  • what i try

    #-------------------------------------------------
    #
    # Project created by QtCreator 2016-10-02T22:34:45
    #
    #-------------------------------------------------
    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = TeamSpeakClientTest
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
            mainwindow.cpp
    
    HEADERS  += mainwindow.h
    
    FORMS    += mainwindow.ui
    
    CONFIG += mobility
    MOBILITY = 
    
    #INCLUDEPATH += $$PWD/include
    #LIBS += $$PWD/lib/ts3client_win32.lib
    
    DISTFILES += \
        android/AndroidManifest.xml \
        android/gradle/wrapper/gradle-wrapper.jar \
        android/gradlew \
        android/res/values/libs.xml \
        android/build.gradle \
        android/gradle/wrapper/gradle-wrapper.properties \
        android/gradlew.bat
    
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
    
    LIBS += -L"D:/WorkPlace/c++ Projects/TeamSpeakClientTest/android/libs" -llibts3client_android.so
    
    

    i got

    :-1: error: error: Projects/TeamSpeakClientTest/android/libs: No such file or directory
    

    please help what should i do and why this error ?


  • Lifetime Qt Champion

    Avoid spaces in the path.



  • all the project path or the Lib ?


  • Lifetime Qt Champion

    To avoid all troubles, all.



  • ok i Avoid spaces in the path for the whole project now i got this error
    from compile output

    23:52:03: Running steps for project TeamSpeakClientTest...
    23:52:03: Configuration unchanged, skipping qmake step.
    23:52:03: Starting: "C:\Qt\Qt5.6.1_Android\Tools\mingw492_32\bin\mingw32-make.exe" 
    mingw32-make: Nothing to be done for 'first'.
    23:52:03: The process "C:\Qt\Qt5.6.1_Android\Tools\mingw492_32\bin\mingw32-make.exe" exited normally.
    23:52:03: Removing directory D:\TRYTHELIB\android-build
    23:52:03: Starting: "C:\Qt\Qt5.6.1_Android\Tools\mingw492_32\bin\mingw32-make.exe" "INSTALL_ROOT=D:\TRYTHELIB\android-build" install
    copy /y libTeamSpeakClientTest.so D:\TRYTHELIB\android-build\libs\armeabi-v7a\libTeamSpeakClientTest.so
            1 file(s) copied.
    23:52:04: The process "C:\Qt\Qt5.6.1_Android\Tools\mingw492_32\bin\mingw32-make.exe" exited normally.
    23:52:04: Starting: "C:\Qt\Qt5.7.0_Android\5.7\android_armv7\bin\androiddeployqt.exe" --input D:/TRYTHELIB/android-libTeamSpeakClientTest.so-deployment-settings.json --output D:/TRYTHELIB/android-build --deployment bundled --android-platform android-23 --jdk "C:/Program Files (x86)/Java/jdk1.8.0_91" --ant C:/QTAndroid/apache-ant-1.9.7/bin/ant.bat
    Generating Android Package
      Input file: D:/TRYTHELIB/android-libTeamSpeakClientTest.so-deployment-settings.json
      Output directory: D:/TRYTHELIB/android-build/
      Application binary: D:/TRYTHELIB/libTeamSpeakClientTest.so
      Android build platform: android-23
      Install to device: No
    Cannot find android sources in D:/TRYTHELIB/android23:52:05: The process "C:\Qt\Qt5.7.0_Android\5.7\android_armv7\bin\androiddeployqt.exe" exited with code 11.
    Error while building/deploying project TeamSpeakClientTest (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.7.0))
    When executing step "Build Android APK"
    23:52:05: Elapsed time: 00:02.
    

    the .pro file

    #-------------------------------------------------
    #
    # Project created by QtCreator 2016-10-02T22:34:45
    #
    #-------------------------------------------------
    
    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = TeamSpeakClientTest
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
            mainwindow.cpp
    
    HEADERS  += mainwindow.h
    
    FORMS    += mainwindow.ui
    
    CONFIG += mobility
    MOBILITY = 
    
    INCLUDEPATH += $$PWD/include
    LIBS += $$PWD/lib/ts3client_win32.lib
    
    DISTFILES += \
        android/AndroidManifest.xml \
        android/gradle/wrapper/gradle-wrapper.jar \
        android/gradlew \
        android/res/values/libs.xml \
        android/build.gradle \
        android/gradle/wrapper/gradle-wrapper.properties \
        android/gradlew.bat \
        android/libs/libts3client_android.so
    
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
    
    LIBS += $$PWD/libts3client_android.so

  • Lifetime Qt Champion

    Shouldn't android/libs/libts3client_android.so rather be $$PWD/libts3client_android.so ?



  • Thank you it compile ok and release a .apk file but when i start app it give me

    unfortunately app has stopped
    

    what cause this problem what i have reach in .pro file

    #-------------------------------------------------
    #
    # Project created by QtCreator 2016-10-02T22:34:45
    #
    #-------------------------------------------------
    
    QT += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = TeamSpeakClientTest
    TEMPLATE = app
    
    
    SOURCES += main.cpp\
      mainwindow.cpp
    
    HEADERS += mainwindow.h
    
    FORMS += mainwindow.ui
    
    CONFIG += mobility
    MOBILITY = 
    
    INCLUDEPATH += $$PWD/include
    LIBS += $$PWD/lib/ts3client_win32.lib
    
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
    
    LIBS += $$PWD/android/libs/libts3client_android.so
    
    DISTFILES += \
      android/AndroidManifest.xml \
      android/gradle/wrapper/gradle-wrapper.jar \
      android/gradlew \
      android/res/values/libs.xml \
      android/build.gradle \
      android/gradle/wrapper/gradle-wrapper.properties \
      android/gradlew.bat \
      android/libs/libts3client_android.so
    
    

    on window this error occurs when i don't but the .dll file in the path of .exe file the application crash and i get
    The program has unexpectedly finished
    but this on windows but what make this crash on android ?


  • Lifetime Qt Champion

    Something's not clear, does it crash when you are running on Windows or on Android ?

    In any case, the full error log is needed.



  • The error after installing the app on android when I start the app on my phone it crashes give this message

    unfortunately, TeamSpeakClientTest has stopped
    

  • Lifetime Qt Champion

    You should have some more lines in the output panel when starting your application. By the way are you using a debug build ?



  • no, i have a problem in debug so I release an APK file and install it direct on my phone


Log in to reply