You are currently viewing Extract android application’s database
<span class="bsf-rt-reading-time"><span class="bsf-rt-display-label" prefix=""></span> <span class="bsf-rt-display-time" reading_time="4"></span> <span class="bsf-rt-display-postfix" postfix="min read"></span></span><!-- .bsf-rt-reading-time -->

Extract android application’s database

This article aims to be a comprehensive guide on how you can extract android application’s database. In this article, I will show how you can extract android application’s database in your local system and then read the database using a simple database reader tool. So Let’s Get Started. 

Introduction

Android uses SQLite database to store the local data on the android phone. SQLite Database is the Default Database that is used by Android applications for local storage. Today I will show you an easy way how you can pull the SQLite database from an Android Device and after that, you can also edit them on your PC. Just Follow the Simple steps and then you can Export SQLite Database in your System.

Requirements for Extracting SQLite Database

  • Android SDK Installed on your System
  • Android application that has SQLite Database Installed on your Android Device
  • Android Device should be rooted

Steps to Extract SQLite Database from Android Application

Step 1. Turn on USB Debugging on your Android Device.

  • For Enable USB Debugging Go to Settings > Developer options
  • By Default Developer options are hidden, use the following steps to enable USB Debugging
  • On your Android Device, go to Settings > About Device
  • Tap on the Build number 7 times to make Developer options available, After 7 times Tap you will see a Toast message which Says “You are now a Developer”.
  • Then enable the USB Debugging option.

Step 2. Now Connect your Android Device to your PC or Laptop.

Step 3. Now you will see a dialog to “Allow USB Debugging” on your Android Device, Select OK.

Step 4. Now open the Command prompt, To open the command prompt Press Windows Key + R and type cmd, and hit Enter. This will open Command Prompt Window.

Step 5. Type adb devices in Command Prompt, this will show the connected devices to your PC or Laptop. 

Step 6. Type adb shell in Command Prompt, and now you will get the android shell on your PC or Laptop.

Step 7. Type su, this will give us the root Privileges.

Step 8. Type cd /data/data . This is the Default Location where all the data is Stored in the Installed Application.

Step 9. Now we need the Package name to Extract the SQLite Database. To get the package name, in your Android go to Settings > Installed Apps > Click on Android Application whose Database we are Extracting.

Now you can see the package name as shown below.

Step 10. Type cd com.yourpackage.name . There type the Package name which you get from the above step.

Step 11. Type cd databases. All the Database files are stored at this location.

Step 12. Type ls. This will list all the available databases, now get the database name from this Step.

Step 13. Press Ctrl+c to exit from the Android Shell.

Step 14. Type adb pull /data/data/com.yourpackage.name/databases/databasename.db  databasename.db. This Command will pull the SQLite Database file to your PC or Laptop.

Now we have a copy of the Database on our System, but we still need some kind of SQLite viewer to view the database Entries. I am using SQLite Database Browser because it is simple to use the tool and it is free. Now. Follow the Next Steps to Open the SQLite Database in our System.

Command used

> adb devices
> adb shell
> su
# cd /data/data/
# cd com.yourpackage.name
# cd Databases
> adb pull /data/data/com.yourpackage.name/databases/databasename.db  databasename.db

View or Edit the SQLite Database

Step 1. You need a Tool to see or edit the SQLite Database entries. DB Browser for SQLite is a very good Windows Tool to see or edit the SQLite Database. Download DB Browser for SQLite and Install it in your System.

Step 2. Open DB Browser for SQLite on your PC or Laptop, Click on Open Database, and Now select the SQLite Database file which we extract from the Android Device from the above steps.  

Step 3. Click on Browse data and Select the table.

Now you can see the Entries of the SQLite database and you can also edit the Database.

Conclusion

So this guide is all about how to extract androids applications SQLite Database from an Android Device and after that open the Database file in SQLite Database Browser to view the entries or edit the entries. It is not very difficult to get a look at the SQLite Database you create in your Android applications, it requires only a few steps. Hope you like this cool trick, do share this trick with others too. Leave a comment below if you have any related queries about this.

Piyush Kumawat

Ethical Hacker || Penetration Tester || Gamer || Blogger || Application Security Engineer

This Post Has One Comment

  1. Education Guide

    Hi I get permission denied error when i extract caknowledge.com app

Leave a Reply