Export/Download SQLite (.db) database of any app using Android Studio


If you are using an SQLite database, a situation may arise where you may want to export your database. Like you may want to view the database graphically in some other application, or send the database to someone, or use it somewhere else. In any case, it becomes difficult to export SQLite database from your app. But here I am to help you out by providing a step by step tutorial on how to find database of your mobile app using Android Studio. So let's begin.

1. Open Android Studio and connect the mobile phone to Android Studio from which you want to export SQLite database.

2. Run the app in the phone and perform whatever operation you want to perform in the database so that it comes in a state where it is ready to be exported.

 To export the database, you must know two things : the database name(which obviously you must be knowing) and other the app's package name. If you know your app's package name skip step 3.

 3. You can check your app's package name in the app level build.gradle file. It is mentioned as applicationId inside defaultConfig section.

 

Now let;s start exporting the database.

4. In the bottom right corner, you will find Device File Explorer. Click on it.


 

5. In the Device File Explorer click on data folder.

 

6. Inside data is another folder named data. Click on it. 

 

7. Now this folder contains the data of all the apps installed on your mobile phone. So here you need to search for the package name of the app whose database is to be exported. Once you find it, open it.


 

8. Inside it, you will find databases folder. Open it.


 

9. Finally here you will find the database file(.db). In our case it's codingwithart.db. Right click on it and click on Save as to save it on your PC at any desired location. 


 

And that's it. Now you can easily do whatever you want with this database file(.db file).

If you have any doubt in any step do comment below.

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook. 

😇Happy Learning!!