Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QNetworkRequest not working on qt 5.8 and android 7.0
Qt 6.12 LTS is out! See what's new in the release blog

QNetworkRequest not working on qt 5.8 and android 7.0

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 7 Posters 9.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joseneas
    wrote on last edited by
    #4

    Hi,

    I have the same issue in my android app when run on Android 7. The application not uses https, and the request is make by javascript with XMLHttpRequest in a qml component.

    The android application crash when start a new request for the remote service.

    Why Qt require openssl for http request?

    I follow the tip described here: http://doc.qt.io/qt-5/opensslsupport.html, but not work for me.

    Any solution for this?

    ekkescornerE 1 Reply Last reply
    0
    • J Offline
      J Offline
      Joseneas
      wrote on last edited by
      #5

      I found a solution for this problem with OpenSSL in Android 7.

      Create a sh file with the code below and execute in same dir of openssl tar.gz file. The version tested is 1.0.2. The file can be download here: https://www.openssl.org/source/. This script will generate the .so files: libcrypto.so and libssl.so.

      #!/bin/sh
      tar xzvf ~/Downloads/openssl-1.0.2g.tar.gz
      cd openssl-1.0.2g
      # path to android ndk folder
      export NDK=~/qt/android-ndk-r13b
      $NDK/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.6 --install-dir=`pwd`/android-toolchain-arm
      export TOOLCHAIN_PATH=`pwd`/android-toolchain-arm/bin
      export TOOL=arm-linux-androideabi
      export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
      export CC=$NDK_TOOLCHAIN_BASENAME-gcc
      export CXX=$NDK_TOOLCHAIN_BASENAME-g++
      export LINK=${CXX}
      export LD=$NDK_TOOLCHAIN_BASENAME-ld
      export AR=$NDK_TOOLCHAIN_BASENAME-ar
      export RANLIB=$NDK_TOOLCHAIN_BASENAME-ranlib
      export STRIP=$NDK_TOOLCHAIN_BASENAME-strip
      export ARCH_FLAGS="-mthumb"
      export ARCH_LINK=
      export CPPFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
      export CXXFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
      export CFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
      export LDFLAGS=" ${ARCH_LINK} "
      # the target of libraries files is armv7
      cd ~/Downloads/openssl-1.0.2g && ./Configure android-armv7 shared
      

      After run the script, open the Makefile and execute the step 5 described here: http://doc.qt.io/qt-5/opensslsupport.html. After edit the Makefile, execute the next commands (into openssl extracted folder) to generate the .so files.

      make clean && PATH=$TOOLCHAIN_PATH:$PATH make
      

      Now, move the .so files to your project.
      To package the .so files into apk, add the below code into .pro file of the project:

          contains(ANDROID_TARGET_ARCH,arm) {
              # update the path of the libraries where you put in your project.
              # I put in: myapp/android/libs/openssl/armeabi-v7a/:
              ANDROID_EXTRA_LIBS = \
                  $$PWD/android/libs/openssl/armeabi-v7a/libcrypto.so \
                  $$PWD/android/libs/openssl/armeabi-v7a/ibssl.so
          }
      
      ekkescornerE 2 Replies Last reply
      0
      • J Joseneas

        Hi,

        I have the same issue in my android app when run on Android 7. The application not uses https, and the request is make by javascript with XMLHttpRequest in a qml component.

        The android application crash when start a new request for the remote service.

        Why Qt require openssl for http request?

        I follow the tip described here: http://doc.qt.io/qt-5/opensslsupport.html, but not work for me.

        Any solution for this?

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by
        #6

        @Joseneas uups ... just did test running one of my projects moved from 5.7 to 5.8 on a Google Pixel C tablet with Android 7.0
        and the same happens here: App is crashing

        W linker  : library "libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.ekkescorner.tt-2/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
        W linker  : library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/org.ekkescorner.tt-2/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve CRYPTO_free
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EVP_CipherFinal
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_ctrl
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_ctrl
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EC_get_builtin_curves
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EC_curve_nist2nid
        W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot call unresolved function OPENSSL_add_all_algorithms_conf
        F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 24205 (QtThread)
        

        running same app from Qt 5.7 all works on Android 7
        this app only uses http://

        ekkescornerE 1 Reply Last reply
        0
        • J Joseneas

          I found a solution for this problem with OpenSSL in Android 7.

          Create a sh file with the code below and execute in same dir of openssl tar.gz file. The version tested is 1.0.2. The file can be download here: https://www.openssl.org/source/. This script will generate the .so files: libcrypto.so and libssl.so.

          #!/bin/sh
          tar xzvf ~/Downloads/openssl-1.0.2g.tar.gz
          cd openssl-1.0.2g
          # path to android ndk folder
          export NDK=~/qt/android-ndk-r13b
          $NDK/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.6 --install-dir=`pwd`/android-toolchain-arm
          export TOOLCHAIN_PATH=`pwd`/android-toolchain-arm/bin
          export TOOL=arm-linux-androideabi
          export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
          export CC=$NDK_TOOLCHAIN_BASENAME-gcc
          export CXX=$NDK_TOOLCHAIN_BASENAME-g++
          export LINK=${CXX}
          export LD=$NDK_TOOLCHAIN_BASENAME-ld
          export AR=$NDK_TOOLCHAIN_BASENAME-ar
          export RANLIB=$NDK_TOOLCHAIN_BASENAME-ranlib
          export STRIP=$NDK_TOOLCHAIN_BASENAME-strip
          export ARCH_FLAGS="-mthumb"
          export ARCH_LINK=
          export CPPFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
          export CXXFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
          export CFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
          export LDFLAGS=" ${ARCH_LINK} "
          # the target of libraries files is armv7
          cd ~/Downloads/openssl-1.0.2g && ./Configure android-armv7 shared
          

          After run the script, open the Makefile and execute the step 5 described here: http://doc.qt.io/qt-5/opensslsupport.html. After edit the Makefile, execute the next commands (into openssl extracted folder) to generate the .so files.

          make clean && PATH=$TOOLCHAIN_PATH:$PATH make
          

          Now, move the .so files to your project.
          To package the .so files into apk, add the below code into .pro file of the project:

              contains(ANDROID_TARGET_ARCH,arm) {
                  # update the path of the libraries where you put in your project.
                  # I put in: myapp/android/libs/openssl/armeabi-v7a/:
                  ANDROID_EXTRA_LIBS = \
                      $$PWD/android/libs/openssl/armeabi-v7a/libcrypto.so \
                      $$PWD/android/libs/openssl/armeabi-v7a/ibssl.so
              }
          
          ekkescornerE Offline
          ekkescornerE Offline
          ekkescorner
          Qt Champions 2016
          wrote on last edited by
          #7
          This post is deleted!
          1 Reply Last reply
          0
          • J Joseneas

            I found a solution for this problem with OpenSSL in Android 7.

            Create a sh file with the code below and execute in same dir of openssl tar.gz file. The version tested is 1.0.2. The file can be download here: https://www.openssl.org/source/. This script will generate the .so files: libcrypto.so and libssl.so.

            #!/bin/sh
            tar xzvf ~/Downloads/openssl-1.0.2g.tar.gz
            cd openssl-1.0.2g
            # path to android ndk folder
            export NDK=~/qt/android-ndk-r13b
            $NDK/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.6 --install-dir=`pwd`/android-toolchain-arm
            export TOOLCHAIN_PATH=`pwd`/android-toolchain-arm/bin
            export TOOL=arm-linux-androideabi
            export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
            export CC=$NDK_TOOLCHAIN_BASENAME-gcc
            export CXX=$NDK_TOOLCHAIN_BASENAME-g++
            export LINK=${CXX}
            export LD=$NDK_TOOLCHAIN_BASENAME-ld
            export AR=$NDK_TOOLCHAIN_BASENAME-ar
            export RANLIB=$NDK_TOOLCHAIN_BASENAME-ranlib
            export STRIP=$NDK_TOOLCHAIN_BASENAME-strip
            export ARCH_FLAGS="-mthumb"
            export ARCH_LINK=
            export CPPFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
            export CXXFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 -frtti -fexceptions "
            export CFLAGS=" ${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64 "
            export LDFLAGS=" ${ARCH_LINK} "
            # the target of libraries files is armv7
            cd ~/Downloads/openssl-1.0.2g && ./Configure android-armv7 shared
            

            After run the script, open the Makefile and execute the step 5 described here: http://doc.qt.io/qt-5/opensslsupport.html. After edit the Makefile, execute the next commands (into openssl extracted folder) to generate the .so files.

            make clean && PATH=$TOOLCHAIN_PATH:$PATH make
            

            Now, move the .so files to your project.
            To package the .so files into apk, add the below code into .pro file of the project:

                contains(ANDROID_TARGET_ARCH,arm) {
                    # update the path of the libraries where you put in your project.
                    # I put in: myapp/android/libs/openssl/armeabi-v7a/:
                    ANDROID_EXTRA_LIBS = \
                        $$PWD/android/libs/openssl/armeabi-v7a/libcrypto.so \
                        $$PWD/android/libs/openssl/armeabi-v7a/ibssl.so
                }
            
            ekkescornerE Offline
            ekkescornerE Offline
            ekkescorner
            Qt Champions 2016
            wrote on last edited by ekkescorner
            #8
            This post is deleted!
            1 Reply Last reply
            0
            • ekkescornerE ekkescorner

              @Joseneas uups ... just did test running one of my projects moved from 5.7 to 5.8 on a Google Pixel C tablet with Android 7.0
              and the same happens here: App is crashing

              W linker  : library "libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.ekkescorner.tt-2/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
              W linker  : library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/org.ekkescorner.tt-2/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve CRYPTO_free
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EVP_CipherFinal
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_ctrl
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve SSL_ctrl
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EC_get_builtin_curves
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot resolve EC_curve_nist2nid
              W libtimetracker10_te_qt.so: (null):0 ((null)): qt.network.ssl: QSslSocket: cannot call unresolved function OPENSSL_add_all_algorithms_conf
              F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 24205 (QtThread)
              

              running same app from Qt 5.7 all works on Android 7
              this app only uses http://

              ekkescornerE Offline
              ekkescornerE Offline
              ekkescorner
              Qt Champions 2016
              wrote on last edited by
              #9

              I'm trying to make it run - see discussion in https://forum.qt.io/topic/76978/android-how-to-install-so-file

              1 Reply Last reply
              0
              • T Offline
                T Offline
                Tchaumont
                wrote on last edited by
                #10

                Hi,

                I compiled libcrypt.so and libssl.so (v1.1.0e). But, when i include in my app i have a crash in android 7.
                If i put off this .so i can test my app in Android 7 but with this warning

                W linker : library "libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
                W linker : library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.

                What can i do for do my App in Android 7?

                ekkescornerE jsulmJ M 3 Replies Last reply
                0
                • T Tchaumont

                  Hi,

                  I compiled libcrypt.so and libssl.so (v1.1.0e). But, when i include in my app i have a crash in android 7.
                  If i put off this .so i can test my app in Android 7 but with this warning

                  W linker : library "libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
                  W linker : library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.

                  What can i do for do my App in Android 7?

                  ekkescornerE Offline
                  ekkescornerE Offline
                  ekkescorner
                  Qt Champions 2016
                  wrote on last edited by
                  #11

                  @Tchaumont for me it works. see also here
                  https://forum.qt.io/topic/77150/qt-5-8-qnam-openssl-crash-openssl_threads
                  from comments seems to work for others too

                  1 Reply Last reply
                  0
                  • T Tchaumont

                    Hi,

                    I compiled libcrypt.so and libssl.so (v1.1.0e). But, when i include in my app i have a crash in android 7.
                    If i put off this .so i can test my app in Android 7 but with this warning

                    W linker : library "libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
                    W linker : library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.

                    What can i do for do my App in Android 7?

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    @Tchaumont said in QNetworkRequest not working on qt 5.8 and android 7.0:

                    i have a crash in android 7

                    What exactly happens? Error message?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • T Tchaumont

                      Hi,

                      I compiled libcrypt.so and libssl.so (v1.1.0e). But, when i include in my app i have a crash in android 7.
                      If i put off this .so i can test my app in Android 7 but with this warning

                      W linker : library "libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
                      W linker : library "libssl.so" ("/system/lib/libssl.so") needed or dlopened by "/data/app/pe.com.medicalint-1/lib/arm/libQt5Core.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.

                      What can i do for do my App in Android 7?

                      M Offline
                      M Offline
                      m.abed
                      wrote on last edited by
                      #13

                      @Tchaumont whats NDK version u use?
                      i think should use for now r10e
                      [https://github.com/ekke/android-openssl-qt/issues/3](link url)

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt
                      • Unsolved