Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Android app unable to connect to the internet?
Forum Updated to NodeBB v4.3 + New Features

Android app unable to connect to the internet?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
10 Posts 2 Posters 1.2k Views 1 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.
  • T Offline
    T Offline
    tubbadu
    wrote on last edited by
    #1

    Hello, I'm writing a QML android App, and I need it to connect to the internet, so in AndroidManifest.xml I added android.permission.INTERNET (using the gui editor in qt creator)
    but this seems not enough, the app is still unable to connect: If I try to simply display an image:

    Image{
        source: "https://doc.qt.io/style/qt-logo-documentation.svg"
    }
    

    in the desktop build it is correctly shown, but in the android app it is not

    what is missing to be able to connect to the internet?

    thanks in advance!

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      you check if android is connected?
      https://stackoverflow.com/questions/17880287/android-programmatically-check-internet-connection-and-display-dialog-if-notco

      T 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        you check if android is connected?
        https://stackoverflow.com/questions/17880287/android-programmatically-check-internet-connection-and-display-dialog-if-notco

        T Offline
        T Offline
        tubbadu
        wrote on last edited by
        #3

        @JoeCFD the device is connected as I'm able (with other apps) to connect to internet

        T JoeCFDJ 2 Replies Last reply
        0
        • T tubbadu

          @JoeCFD the device is connected as I'm able (with other apps) to connect to internet

          T Offline
          T Offline
          tubbadu
          wrote on last edited by
          #4

          if I try to set the source of the image while live debugging the android device, this is the output:

          E linker  : library "/system/lib/libcrypto.so" ("/system/lib/libcrypto.so") needed or dlopened by "/data/app/org.tubbadu.biscottinoqt-fw5Qe1IQHoLuUmWbs2OFdg==/lib/arm/libQt6Core_armeabi-v7a.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.tubbadu.biscottinoqt-fw5Qe1IQHoLuUmWbs2OFdg==/lib/arm:/data/app/org.tubbadu.biscottinoqt-fw5Qe1IQHoLuUmWbs2OFdg==/base.apk!/lib/armeabi-v7a", permitted_paths="/data:/mnt/expand:/data/data/org.tubbadu.biscottinoqt"]
          W qt.tlsbackend.ossl: : Failed to load libssl/libcrypto.
          W qt.network.ssl: : The backend "cert-only" does not support QSslKey
          W qt.network.ssl: : Active TLS backend does not support key creation
          W qt.network.ssl: : The backend "cert-only" does not support QSslKey
          W qt.network.ssl: : Active TLS backend does not support key creation
          W qt.network.ssl: : The backend "cert-only" does not support QSslKey
          W qt.network.ssl: : Active TLS backend does not support key creation
          W qt.network.ssl: : The backend "cert-only" does not support QSslKey
          W qt.network.ssl: : Active TLS backend does not support key creation
          W qt.network.ssl: : The backend "cert-only" does not support QSslKey
          W qt.network.ssl: : Active TLS backend does not support key creation
          W qt.network.ssl: : The backend "cert-only" does not support QSslKey
          W qt.network.ssl: : Active TLS backend does not support key creation
          W qt.network.ssl: : The backend "cert-only" does not support QSslSocket
          W qt.network.ssl: : The backend named "cert-only" does not support TLS
          W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
          W Biscottino!: qrc:/biscottino-qt/GamePage.qml:134:3: QML QQuickImage: TLS initialization failed
          
          1 Reply Last reply
          0
          • JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #5

            you need to add it on
            Qt Creator->Tools->Options->Devices->Android(tab)->Android OpenSSL settings
            click Download Open SSL

            T 1 Reply Last reply
            0
            • T tubbadu

              @JoeCFD the device is connected as I'm able (with other apps) to connect to internet

              JoeCFDJ Offline
              JoeCFDJ Offline
              JoeCFD
              wrote on last edited by
              #6

              @tubbadu How did you code to connect internet in Qt?

              1 Reply Last reply
              0
              • JoeCFDJ JoeCFD

                you need to add it on
                Qt Creator->Tools->Options->Devices->Android(tab)->Android OpenSSL settings
                click Download Open SSL

                T Offline
                T Offline
                tubbadu
                wrote on last edited by
                #7

                @JoeCFD said in Android app unable to connect to the internet?:

                you need to add it on
                Qt Creator->Tools->Options->Devices->Android(tab)->Android OpenSSL settings
                click Download Open SSL

                it says it's already configured

                How did you code to connect internet in Qt?

                what do you mean? I just tried to set the Image source to https://doc.qt.io/style/qt-logo-documentation.svg (or any other https image, png, jpeg, svg...), on the desktop application it just work, while on android doesn't work

                JoeCFDJ 1 Reply Last reply
                0
                • T tubbadu

                  @JoeCFD said in Android app unable to connect to the internet?:

                  you need to add it on
                  Qt Creator->Tools->Options->Devices->Android(tab)->Android OpenSSL settings
                  click Download Open SSL

                  it says it's already configured

                  How did you code to connect internet in Qt?

                  what do you mean? I just tried to set the Image source to https://doc.qt.io/style/qt-logo-documentation.svg (or any other https image, png, jpeg, svg...), on the desktop application it just work, while on android doesn't work

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by JoeCFD
                  #8

                  @tubbadu
                  if you use pro file, add this to it

                  LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libssl_1_1.so
                  LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libcrypto_1_1.so
                  
                  for Qt5 add this also
                  ANDROID_EXTRA_LIBS += \
                                        $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libssl_1_1.so \
                                        $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libcrypto_1_1.so
                  
                  T 1 Reply Last reply
                  0
                  • JoeCFDJ JoeCFD

                    @tubbadu
                    if you use pro file, add this to it

                    LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libssl_1_1.so
                    LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libcrypto_1_1.so
                    
                    for Qt5 add this also
                    ANDROID_EXTRA_LIBS += \
                                          $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libssl_1_1.so \
                                          $$ANDROID_SDK_ROOT/android_openssl/latest/arm64/libcrypto_1_1.so
                    
                    T Offline
                    T Offline
                    tubbadu
                    wrote on last edited by
                    #9

                    @JoeCFD I'm building the app with the kit "Android Qt 6.4.1 armeabi-v7a", so using arm64/libssl_1_1.so causes the application to crash on start
                    using instead

                    LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm/libssl_1_1.so
                    LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm/libcrypto_1_1.so
                    

                    builds the application correctly, but nothing changes:

                    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
                    W qt.network.ssl: : Active TLS backend does not support key creation
                    W qt.network.ssl: : The backend "cert-only" does not support QSslKey
                    W qt.network.ssl: : Active TLS backend does not support key creation
                    W qt.network.ssl: : The backend "cert-only" does not support QSslSocket
                    W qt.network.ssl: : The backend named "cert-only" does not support TLS
                    W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
                    D InputMethodManager: HSIFW - flag : 0 Pid : 25979
                    I InputMethodManager: hideSoftInputFromWindow ignore mServedView == null or mServedView.getWindowToken() != windowToken, mServedView :DecorView@b758b0e[QtActivity]
                    W Biscottino!: qrc:/biscottino-qt/main.qml:17:2: QML QQuickImage: TLS initialization failed
                    

                    perhaps an older version of qt may fix this? should I try to build with qt5?
                    thanks for your time!

                    JoeCFDJ 1 Reply Last reply
                    0
                    • T tubbadu

                      @JoeCFD I'm building the app with the kit "Android Qt 6.4.1 armeabi-v7a", so using arm64/libssl_1_1.so causes the application to crash on start
                      using instead

                      LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm/libssl_1_1.so
                      LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm/libcrypto_1_1.so
                      

                      builds the application correctly, but nothing changes:

                      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
                      W qt.network.ssl: : Active TLS backend does not support key creation
                      W qt.network.ssl: : The backend "cert-only" does not support QSslKey
                      W qt.network.ssl: : Active TLS backend does not support key creation
                      W qt.network.ssl: : The backend "cert-only" does not support QSslSocket
                      W qt.network.ssl: : The backend named "cert-only" does not support TLS
                      W qt.network.ssl: : QSslSocket::connectToHostEncrypted: TLS initialization failed
                      D InputMethodManager: HSIFW - flag : 0 Pid : 25979
                      I InputMethodManager: hideSoftInputFromWindow ignore mServedView == null or mServedView.getWindowToken() != windowToken, mServedView :DecorView@b758b0e[QtActivity]
                      W Biscottino!: qrc:/biscottino-qt/main.qml:17:2: QML QQuickImage: TLS initialization failed
                      

                      perhaps an older version of qt may fix this? should I try to build with qt5?
                      thanks for your time!

                      JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on last edited by JoeCFD
                      #10

                      @tubbadu I use Qt5.15.2 and do not have issues with ssl.

                      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 Extensions
                      • Unsolved