Android app unable to connect to the internet?
-
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!
-
you check if android is connected?
https://stackoverflow.com/questions/17880287/android-programmatically-check-internet-connection-and-display-dialog-if-notco -
you check if android is connected?
https://stackoverflow.com/questions/17880287/android-programmatically-check-internet-connection-and-display-dialog-if-notco -
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
-
you need to add it on
Qt Creator->Tools->Options->Devices->Android(tab)->Android OpenSSL settings
click Download Open SSL@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 SSLit 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 -
@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 SSLit 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@tubbadu
if you use pro file, add this to itLIBS += $$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
-
@tubbadu
if you use pro file, add this to itLIBS += $$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
@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 insteadLIBS += $$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! -
@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 insteadLIBS += $$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!