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

problem in generating .so files using msys2 tool for qt on android



  • I am trying to port my qt project on Android. I am using qt5.14.1 and NDK r21 with SDK API level 26. In the project, I used Openssl libraries for internet connectivity. Now I am trying to generate OpenSSL libs(i.e. libcrypto_1_1.so, libssl_1_1.so) using msys2 tool. I refer https://doc.qt.io/qt-5/android-openssl-support.html to generate the libraries.

    263b3994-0464-4334-b8c8-c3f34282f4de-image.png

    its getting error that the GCC compiler for android not found. Please tell me how can I set the path for the android GCC compiler and generate OpenSSL libraries or is there any other method to generate these libraries.

    I also tried with libcrypto.so and libssl.so libraries but its getting errors due to some compatibility issues.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Please take a look at KDAB's Androïd OpenSSL project. It should simplify things.



  • thanks for reply. I tried those libraries. get request is working fine in it but the post request is not working.

    QUrl targateUrl = m_apiUrlHelper->getLoginURL()+"?clientName="+ m_apiUrlHelper->getServerClientName();
        qDebug() << targateUrl;
    
        QVariantMap feed;
        feed.insert("username",userName);
        feed.insert("password",password);
    
        QByteArray payload=QJsonDocument::fromVariant(feed).toJson();
        qDebug() << payload;
    
        //send request to url
        QNetworkRequest request;
        request.setUrl(targateUrl);
        request.setHeader(QNetworkRequest::ContentTypeHeader,"application/json");
    
        QNetworkAccessManager *restclient; //in class
        restclient = new QNetworkAccessManager(); //constructor
        connect(&m_loginprocessor, SIGNAL(dataReady(QString)), this, SLOT(handleGetUserResponse(QString)));
        connect(restclient, SIGNAL(finished(QNetworkReply*)), &m_loginprocessor, SLOT(handleAPIResponse(QNetworkReply*)));
        restclient->setStrictTransportSecurityEnabled(true);
        restclient->post(request,payload);
    

    I tried this for post request. This code is working fine on windows platform but for android platform it doesn't give any responce. I didn't understand is there any issue with libraries or code. any sugestions on it.


  • Lifetime Qt Champion

    Did you deploy the OpenSSL libraries along your application on Android ?



  • yes I did. the get request is working in it.


Log in to reply