Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

USB debugging how to get database file?

Hi I know that when we are using emulator for run an App in android we are able to get the database and shared preference file from File explorer. Like wise is there any method to obtain the database and shared preference from device when we are testing the App using usb debugging.

Any help will be appreciable

like image 653
Arun Antoney Avatar asked May 20 '26 04:05

Arun Antoney


1 Answers

Assuming your device is not rooted.

In this case, you have to make sure the app you want to retrieve is debug signed (not a 3rd party commercial app).

Then there are 2 ways to get the db and other files:

Way 1: See the content inside adb shell

Run below command:

adb shell

run-as [your app package name] 

(above command will let you to go to /data/data/[your app package name] folder)

cd databases

sqlite3 [your database file name]

(this will start a sqlite3 prompt, you can do simple db browsing with it)

Way 2: Pull the file to local

Run below command:

adb shell run-as [your app package name] chmod 666 databases/[your databases file name]

adb pull /data/data/[your app package name]/databases/[your database file name]
like image 51
Fei Avatar answered May 21 '26 22:05

Fei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!