Development issue/problem:

I am currently working on a WiFi application for Android. I’m having trouble accessing the device’s database. Debugging in the emulator does not work for me because the emulator does not support WiFi. I tried to extract the file from the device’s database using

retrieve adb data/data/package/database name

But I got the error message Permission denied.
In this answer, Android: Where the database files are stored, Commonsware suggested removing the file from the database by executing the debug mode. But that doesn’t work either. Any help with troubleshooting the database without routing the device is greatly appreciated.

How can I solve this problem?

Solution 1:

I’ll repeat myself with a different answer:

From API level 8 (Android 2.2) onwards, when creating an application as a debugger, you can use the Run-as-shell to execute a command or executable on behalf of a specific user/application, or simply browse your application’s UID to access the data folder.

So, if you want to retrieve the application database from the device, you need to run the debug compilation of the application, login via the adb shell and execute the following command:

run-as com.yourpackage sh -c cat ~/databases/db-file > /sdcard/db-file.sqlite

This will copy your db file to the root directory of the SD card/external storage. Now you can just take it with you with a case manager, a salesman or whatever. Note that with this approach, your application does not need to have WRITE_EXTERNAL_STORAGE authorization, as the copy is made by the shell user, who can still write data to the external memory.

On Linux/Mac systems it is possible to copy the database directly to the computer without entering the adb-shell with the following command:

adb shell ‘run-as com.yourpackage sh -c cat ~/databases/db-file’ > db-file.sqlite

However, this does not work well under Windows because of the CR/LF character conversion. In this case, use the old method.

Solution 2:

I use this shell script on my MAC that copies the database directly to my personal folder. Simple one-click solution, just change the name of the package ( and the name of the database (database.sqlite).

Simple scenario

shell adb -d ‘run-as cat /data/data/ > /sdcard/database.sqlite’
adb pull /sdcard/database.sqlite ~/

A script that accepts [packet name] [database] arguments.

#! /bin/bash

ADB_PATH=/User/Tadas/Library/sdk/platform tools/adb

If [ $# -ne $REQUIRED_ARGS ] , then
echo Use:
echo [packet name] [db_name] echo z. B. lt.appcamp.impulse.db
output 1
fi ;


cmd1=$ADB_PATH -d shell ‘run-as $1 cat /data/$1/databases/$2’
cmd2=$ADB_PATH pull /sdcard/$2 $PULL_DIR

echo $cmd1
eval $cmd1
if [ $ ? -eq 0 ] then
echo ………OK
fi ;

ultrasound $cmd2
eval $cmd2

if [ $ ? -eq 0 ] , then
echo ………OK
fi ;

Output 0

Solution 3:

The best way to view and manage the database of your Android application is to use this library

This library allows you to manage your application’s SQLite database from within the application itself.
you can view, update, delete tables in the database of your application, insert rows in the tables, all in your application.

This is a single activity java file, paste the java file into the source directory. When development is complete, delete the Java file from your src folder that contains it.

It helped me a lot. I hope you do, too.

You can watch a one-minute demonstration here:

Solution 4:

Although I think it’s an old question, it’s still relevant and deserves an answer as it is now. There are tools that make it possible to examine databases directly (without having to remove them from the device or emulator).

The tool I recently discovered (and which I prefer) is the Android debugging database.

Add this dependency:

debugImplementation ‘’.

No additional code is required.
After starting the application, open the logcat and filter for DebugDB and you will see a message that reads.

D/DebugDB : Open http://192.168.178.XXX:8080 in your browser

It works with any browser and you can view the database tables and general settings.

Debugging sqlite database on the device –

It also works with standard and Genymotion emulators.

The tool I’ve used so far is a stetho.

Disadvantage: You need to add code and you are linked to the Chrome browser.

Advantage: You also have the ability to monitor network traffic.

Solution No 5:

In my application I export the database to an SD card. Once the database is on the SD card, it can be accessed by connecting the device to a computer.

Look at this message: Backing up the SDCard database on Android.

Solution No 6:

If you

The system cannot find the specified path.


adb -d shell run-as com.yourpackage cat /data/data/com.yourpackage/databases/dbname.sqlite > /sdcard/dbname.sqlite

Pay attention to the quotation marks!

Solution No 7:

The new Android Studio 4.1 offers a new database inspector.

Debugging sqlite database on the device –

You can select the following options from the menu bar View > Windows Tool > Database Inspector to open it (App Inspector in Android Studio 4.2). For more detailed instructions, see this blog and the article Exploring the Database Inspector in Android Studio.

Another option is the use of a stethos. If you add a dependency, you can use Chrome DevTools ( chrome://inspect ) to check the database when you connect the device.

Solution No 8:

I just did:

adb shell
[protected via e-mail]:/$ run-as sh
[protected via e-mail]:/data/data/ $

Then I can debug the sqlite database or whatever I want to do with the proper rights.

Solution No 9:

There is a way, when apk debugs, to use a program called run axis of the adb (non-root) shell to copy the private file of the application.

Solution No 10:

Here are step-by-step instructions, most of which are derived from a combination of other answers. This works with devices that are not unlocked.

  1. Connect the device and run the application in debug mode.
  2. Copy the database file from the application folder to the SD card: Execute:

./adb -d shell ‘run-as cat /data/ > /sdcard/filename.sqlite’.

  1. Drag and drop files from the database to your computer: Execute:

./adb pull /sdcard/ execute: ./adb

  1. Install the SQLLite manager of Firefox:
  2. Open Firefox SQLLite Manager and open the database file from step 3.
  3. Have fun!

Good luck!

how to breed donkeys in minecraft,minecraft horse propagation,how to make golden carrots,how to make golden apples,how to breed horses in real life,how to breed skeleton horses in minecraft,how to breed horses and donkeys,how to get golden apples in minecraft,how to make golden carrots in minecraft,minecraft horse stats mod,minecraft best horse command,horse speed tester minecraft,ender horse,give best horse minecraft,minecraft horse stable,how to feed a horse in minecraft ps4,how to breed llamas in minecraft,how to breed horses bdo,how to feed animals in minecraft pe,how to tame a sheep in minecraft,what do cows eat in minecraft,how to tame a chicken in minecraft,how to breed chickens in minecraft,minecraft breed all the animals advancement,how to make horses grow faster,how to make golden carrot in minecraft,how to breed villagers in minecraft 2020,minecraft horse breeding chart,minecraft horse breeding guide,how to breed horses in minecraft 2020,minecraft horse breeding chart vanilla,how to feed a horse in minecraft,how to get a fast horse in minecraft,how to breed horses and donkeys in minecraft,minecraft horse breeding colors

You May Also Like

How to fix ‘PS4 error CE-30002-5’?

The PS4 is one of the best consoles Sony has ever released.…

The printer requires your attention error

Download DriverFix 2. print the pages of the website using a different…

Best Flash Tool for Samsung Galaxy Tab Pro 8.4 (Free Download)

Best Flash Tool for Samsung Galaxy Tab Pro 8.4 (Free Download) If…

How to Power Off & Restart Samsung Galaxy S21, S21+ and S21 Ultra

Samsung has finally released the flagship of its 2021 smartphone series –…