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. Downloading data from Web URL (For Android)
Forum Updated to NodeBB v4.3 + New Features

Downloading data from Web URL (For Android)

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 4 Posters 1.4k 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.
  • M Offline
    M Offline
    Mathematician
    wrote on last edited by
    #1

    Hello Qt Community,

    I'm very new to Qt's networking and I am trying to download data from a csv file from a web URL on the Android phone. I am using the filedownloader.h file from this link:

    https://wiki.qt.io/Download_Data_from_URL

    While the link talks about downloading an image, I figured it could also download numerical data as well. As a test run, I decided to try downloading an image first to see if it will simply do anything at all. In my main.cpp file, I have the following code:

    #include "filedownloader.h"   // From the Qt Website (https://wiki.qt.io/Download_Data_from_URL)
    
    int main(int argc, char *argv[])
    {
       QApplication a(argc, argv);
    
       // The main window of the phone
       QWidget* window = new QWidget;
    
       window->setBackgroundRole(QPalette::Dark);
    
       QUrl imageUrl("https://freepngimg.com/download/the_elder_scrolls/23365-4-the-elder-scrolls-v-skyrim-transparent-background.png");
       FileDownloader* m_pImgCtrl = new FileDownloader(imageUrl, window);
       QObject::connect(m_pImgCtrl, SIGNAL (downloaded()), window, SLOT (loadImage()));
    
       QPixmap buttonImage;     
       buttonImage.loadFromData(m_pImgCtrl->downloadedData());
    
       window->show();
       return a.exec();
    }
    

    However, I keep getting the following errors:

    "W System.err: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.network.QtNetwork" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /vendor/lib]]
    W System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    W System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    W System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    W System.err: at org.qtproject.qt5.android.QtNative.startQtApplication(Native Method)
    W System.err: at org.qtproject.qt5.android.QtNative$7.run(QtNative.java:611)
    W System.err: at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
    W System.err: at java.lang.Thread.run(Thread.java:761)"

    It appears I am missing a path but do I put that path on the android itself or is there a different problem entirely? If there is even a better and much simpler way to achieve my goal, please share!

    Thank you!

    O 1 Reply Last reply
    0
    • M Mathematician

      Hello Qt Community,

      I'm very new to Qt's networking and I am trying to download data from a csv file from a web URL on the Android phone. I am using the filedownloader.h file from this link:

      https://wiki.qt.io/Download_Data_from_URL

      While the link talks about downloading an image, I figured it could also download numerical data as well. As a test run, I decided to try downloading an image first to see if it will simply do anything at all. In my main.cpp file, I have the following code:

      #include "filedownloader.h"   // From the Qt Website (https://wiki.qt.io/Download_Data_from_URL)
      
      int main(int argc, char *argv[])
      {
         QApplication a(argc, argv);
      
         // The main window of the phone
         QWidget* window = new QWidget;
      
         window->setBackgroundRole(QPalette::Dark);
      
         QUrl imageUrl("https://freepngimg.com/download/the_elder_scrolls/23365-4-the-elder-scrolls-v-skyrim-transparent-background.png");
         FileDownloader* m_pImgCtrl = new FileDownloader(imageUrl, window);
         QObject::connect(m_pImgCtrl, SIGNAL (downloaded()), window, SLOT (loadImage()));
      
         QPixmap buttonImage;     
         buttonImage.loadFromData(m_pImgCtrl->downloadedData());
      
         window->show();
         return a.exec();
      }
      

      However, I keep getting the following errors:

      "W System.err: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.network.QtNetwork" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /vendor/lib]]
      W System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      W System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
      W System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      W System.err: at org.qtproject.qt5.android.QtNative.startQtApplication(Native Method)
      W System.err: at org.qtproject.qt5.android.QtNative$7.run(QtNative.java:611)
      W System.err: at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
      W System.err: at java.lang.Thread.run(Thread.java:761)"

      It appears I am missing a path but do I put that path on the android itself or is there a different problem entirely? If there is even a better and much simpler way to achieve my goal, please share!

      Thank you!

      O Offline
      O Offline
      Obsess
      wrote on last edited by
      #2

      @Mathematician, I'm seeing the same thing as well (in fact, I just noticed it and searched online about it and found your post). My stack is:

      W System.err: java.lang.ClassNotFoundException: Didn't find class "org.qtproject.qt5.android.network.QtNetwork" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib64, /product/lib64]]
      W System.err: 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
      W System.err: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
      W System.err: 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
      W System.err: 	at org.qtproject.qt5.android.QtNative.startQtApplication(Native Method)
      W System.err: 	at org.qtproject.qt5.android.QtNative$7.run(QtNative.java:611)
      W System.err: 	at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
      W System.err: 	at java.lang.Thread.run(Thread.java:919)
      

      Other than this output things still appear to be working though. I'm on 5.15.1. I don't think it's anything you (or I) are doing wrong.

      Are things working for you despite this?

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tomaslov
        wrote on last edited by
        #3

        I tested my app in Qt 5.15.1 for the first time today, and get the same error as you mentioned. The network stuff I've tested so far seem to work despite this warning.

        I also see there is a bugreport for this: https://bugreports.qt.io/browse/QTBUG-87288

        S 1 Reply Last reply
        0
        • T tomaslov

          I tested my app in Qt 5.15.1 for the first time today, and get the same error as you mentioned. The network stuff I've tested so far seem to work despite this warning.

          I also see there is a bugreport for this: https://bugreports.qt.io/browse/QTBUG-87288

          S Offline
          S Offline
          swk.
          wrote on last edited by
          #4

          Here is a manual fix for this issue.
          https://forum.qt.io/topic/123668/manual-fix-for-org-qtproject-qt5-android-network-qtnetwork-class-not-found

          1 Reply Last reply
          1

          • Login

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