<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Load files (databases, audio files, images) to Android Emulator devices internal storage]]></title><description><![CDATA[<p dir="auto">Dear Qt Devs,</p>
<p dir="auto">I create this post because it answers at least 100 topics that are all under a different name in hope that future posts get linked to this one and people contribute to the solution provided here.</p>
<p dir="auto">Lets say your app uses a database file. When you build your project on a windows system and the target is set to an android device <img src="https://ddgobkiprc33d.cloudfront.net/d7a74c17-db41-43a9-8bae-b0a30df4da38.png" alt="deploy_button.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Unfortunately, the database file(or audio files or whatever), even though you might have it added under the resources in CMAKE file in your project, won't be copied in the internal memory of the target device image ( in this case the AndroidTablet AVD).</p>
<p dir="auto">To fix this,</p>
<ol>
<li>
<p dir="auto">go to the SDK folder path in windows explorer: <img src="https://ddgobkiprc33d.cloudfront.net/51e0895e-36c4-4ad5-8ea1-73b466ca1f1f.png" alt="sdk_location.png" class=" img-fluid img-markdown" /><br />
, and open platform-tools folder which contains the adb.exe executable. While in this folder, type powershell in the address bar to start powershell at this location:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/35306d19-c25e-4ff1-a239-af0e7d736393.png" alt="powershell_command_adb.png" class=" img-fluid img-markdown" /></p>
</li>
<li>
<p dir="auto">Your emulator needs to be running for the file transfer commands to work, either start it by running your programm, or use  Start AVD button from Preferences -&gt; Devices inside of Qt-Creator.</p>
</li>
<li>
<p dir="auto">Now in PowerShell, use <code>.\adb.exe shell pm list packages -3</code> , to list 3rd party installed packages which should list your app name that you can use in next steps: <img src="https://ddgobkiprc33d.cloudfront.net/0929d299-57b4-41ba-b22f-3ea658c21167.png" alt="list_packages.png" class=" img-fluid img-markdown" /></p>
</li>
<li>
<p dir="auto">Since I think one cannot access the app files folder directly you first need to push the files to a temporary location(can also be sd card memory) of the AVD. Use push command <code>.\adb.exe push "C:\Qt_test_projects\example-db" /data/local/tmp/example-db</code> and it will copy the file from your windows folder to the android emulated device: <img src="https://ddgobkiprc33d.cloudfront.net/9056d523-2e93-4c99-a52d-8d2a7804fdb8.png" alt="push_file_to_tmp_location.png" class=" img-fluid img-markdown" /></p>
</li>
<li>
<p dir="auto">copy (alternatively - move) the file inside your app files folder using run-as command option with the previously retrieved package name <code>.\adb.exe shell run-as org.qtproject.example.appsqlmodel cp /data/local/tmp/example-db files/example-db</code>  to access it: <img src="https://ddgobkiprc33d.cloudfront.net/59417192-56c8-4fd3-93bc-4b691716a57b.png" alt="copy_file.png" class=" img-fluid img-markdown" /></p>
</li>
<li>
<p dir="auto">Now your file should be in the files folder that is the default path where your main app will look for, you can list the files in this folder using <code>.\adb.exe shell run-as org.qtproject.example.appsqlmodel ls -l files</code> command.:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/53f89b10-198b-4ce5-a90a-26f70a116921.png" alt="files_folder_content.png" class=" img-fluid img-markdown" /><br />
You can also check the working directory name through your main.cpp file and check if that resource exists, for this you need to include &lt;QDebug&gt; ,&lt;QDir&gt; and &lt;QFileInfo&gt; in the main.cpp and then use:</p>
</li>
</ol>
<pre><code>qDebug() &lt;&lt; "Working directory:" &lt;&lt; QDir::currentPath();
qDebug() &lt;&lt; "Database path:"&lt;&lt; QFileInfo("./example-db").absoluteFilePath();
qDebug() &lt;&lt; "Database exists:" &lt;&lt; QFileInfo::exists("./example-db");
qDebug() &lt;&lt; "Database size:" &lt;&lt; QFileInfo("./example-db").size();
</code></pre>
<p dir="auto">this will give you some info in the application output window when you run it:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/b22d3330-adf3-47f9-8b29-b17d080a3c97.png" alt="application_output_debug_messages.png" class=" img-fluid img-markdown" /></p>
<ol start="7">
<li>Enjoy that your App in your Android Emulator doesn't crash and can load the resources it should be loading  PayPal me some money lol.</li>
</ol>
<p dir="auto">Cheers</p>
]]></description><link>https://forum.qt.io/topic/165201/load-files-databases-audio-files-images-to-android-emulator-devices-internal-storage</link><generator>RSS for Node</generator><lastBuildDate>Thu, 22 Oct 2026 21:00:45 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/165201.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Oct 2026 08:52:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Load files (databases, audio files, images) to Android Emulator devices internal storage on Thu, 22 Oct 2026 19:50:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a>  Yes, AI suggested something along those lines, but even if it is inexpensive it checks if there is database in the file system every time the app is started. I meant it more for scaling packages, like additional audio files for different languages that one would fetch to the local file system, different themes etc. its reasonable to have them outside of the executable so that its size is not inflated by stuff thats not being used.</p>
<p dir="auto">Android has its own built in file tree system for the different resources (even for databases and cloud databases), it would probably be reasonable to utilize them, I hoped there would be some templates <img src="https://ddgobkiprc33d.cloudfront.net/3bab98a6-4f8a-458d-bd0d-6c21df6cecb1.png" alt="android_templates.png" class=" img-fluid img-markdown" /> ,<br />
but unfortunately <a href="https://doc.qt.io/qtcreator/creator-deploying-android.html" target="_blank" rel="noopener noreferrer nofollow ugc">the page</a> doesn't exist 😂</p>
]]></description><link>https://forum.qt.io/post/840576</link><guid isPermaLink="true">https://forum.qt.io/post/840576</guid><dc:creator><![CDATA[DSpUz]]></dc:creator><pubDate>Thu, 22 Oct 2026 19:50:10 GMT</pubDate></item><item><title><![CDATA[Reply to Load files (databases, audio files, images) to Android Emulator devices internal storage on Thu, 22 Oct 2026 17:59:16 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">When you have such "initial files" for your application, one thing you can do is to put them in resources and then as part of your application initialization, copy them to the correct folder using <a href="https://doc.qt.io/qt-6/qstandardpaths.html" target="_blank" rel="noopener noreferrer nofollow ugc">QStandardPaths</a> (don't forget to check if the file already exists first).</p>
<p dir="auto">For databases, it's also usually a good idea to have the full database initialization in your code as well so you can simply create it / update it on startup.</p>
]]></description><link>https://forum.qt.io/post/840572</link><guid isPermaLink="true">https://forum.qt.io/post/840572</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 22 Oct 2026 17:59:16 GMT</pubDate></item><item><title><![CDATA[Reply to Load files (databases, audio files, images) to Android Emulator devices internal storage on Thu, 22 Oct 2026 12:59:13 GMT]]></title><description><![CDATA[<p dir="auto">Or you can also follow the easier <a href="https://doc.qt.io/qt-6/porting-to-android.html" target="_blank" rel="noopener noreferrer nofollow ugc">official line</a> , however I suggest walking through mine first to be able to verify what has or hasn't been deployed to the device</p>
]]></description><link>https://forum.qt.io/post/840571</link><guid isPermaLink="true">https://forum.qt.io/post/840571</guid><dc:creator><![CDATA[DSpUz]]></dc:creator><pubDate>Thu, 22 Oct 2026 12:59:13 GMT</pubDate></item></channel></rss>