Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. JPEG support in Android

JPEG support in Android

Scheduled Pinned Locked Moved Mobile and Embedded
androidandroiddeployqtplugin
12 Posts 3 Posters 3.7k Views
  • 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.
  • M Offline
    M Offline
    m_andrej
    wrote on 24 Jun 2015, 18:32 last edited by m_andrej
    #1

    Hi,
    QImageReader::supportedImageFormats() prints on Android "bmp", "pbm", "pgm", "png", "ppm", "xbm", "xpm" while on Desktop it also includes jpg. Due to this, QImage::loadFormData() fails. How can I enable jpg support in Android?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 24 Jun 2015, 20:44 last edited by
      #2

      Hi,

      Plugin not deployed ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 25 Jun 2015, 08:46
      0
      • S SGaist
        24 Jun 2015, 20:44

        Hi,

        Plugin not deployed ?

        M Offline
        M Offline
        m_andrej
        wrote on 25 Jun 2015, 08:46 last edited by
        #3

        @SGaist I added QTPLUGIN += qjpeg in the *.pro file, if that's what you mean. Didn't help.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          m_andrej
          wrote on 25 Jun 2015, 10:39 last edited by
          #4

          I have some more information.
          I run androiddeployqt with --verbose option and it shows that libqjpeg.so is copied to *.apk:

          -- Copied /home/andrej/programovanie/build-trance-Android_for_armeabi_v7a_GCC_4_9_Qt_5_4_2-Release/android-build//libs/armeabi-v7a/libplugins_imageformats_libqjpeg.so
          

          The file is also present in bundled_in_lib section of res/values/libs.xml.
          However, at runtime the application output doesn't show any error loading the library.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 26 Jun 2015, 20:47 last edited by
            #5

            What do you get if you set QT_DEBUG_PLUGINS ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply 27 Jun 2015, 10:18
            0
            • S SGaist
              26 Jun 2015, 20:47

              What do you get if you set QT_DEBUG_PLUGINS ?

              M Offline
              M Offline
              m_andrej
              wrote on 27 Jun 2015, 10:18 last edited by
              #6

              @SGaist How can I set environment variables on Android?

              1 Reply Last reply
              0
              • M Offline
                M Offline
                m_andrej
                wrote on 27 Jun 2015, 11:21 last edited by
                #7

                I went back to older revisions of my code and realized that JPEG plugin was working before. By trying various revisions I was able to locate the change in code that prevented the plugin from loading. It was in my server communicator class:

                class CServerCommunicator : public QObject
                {
                ...
                private:	
                	static QNetworkAccessManager *m_netManager;
                	static QString m_sessionID;
                	QNetworkReply *m_reply;
                };
                

                This line in CServerCommunicator.cpp was actually the problem:

                QNetworkAccessManager *CServerCommunicator::m_netManager = new QNetworkAccessManager();
                

                Instead of static member m_netManager, I made a method which creates network manager as static local variable and returns its address. Now the JPEG plugin works fine on Android.

                This is clearly some bug, so I will make a bug report from this.

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gyll
                  wrote on 27 Jun 2015, 11:42 last edited by
                  #8

                  Can you please add the bug report's URL here, i'd like to monitor the progress too

                  M 1 Reply Last reply 27 Jun 2015, 14:10
                  0
                  • G gyll
                    27 Jun 2015, 11:42

                    Can you please add the bug report's URL here, i'd like to monitor the progress too

                    M Offline
                    M Offline
                    m_andrej
                    wrote on 27 Jun 2015, 14:10 last edited by
                    #9

                    @gyll https://bugreports.qt.io/browse/QTBUG-46901

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 27 Jun 2015, 21:35 last edited by
                      #10

                      Out of curiosity, why a static QNetworkAccessManager ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        m_andrej
                        wrote on 27 Jun 2015, 21:56 last edited by
                        #11

                        Because you should have only one network manager in the entire application. AFAIK this is in the official docs.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 27 Jun 2015, 22:04 last edited by
                          #12

                          You misunderstood that part. The doc says that one should be enough, not that you should only have one.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0

                          5/12

                          26 Jun 2015, 20:47

                          • Login

                          • Login or register to search.
                          5 out of 12
                          • First post
                            5/12
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved