This question already has answers here:
Android - Pulling SQlite database android device
(19 answers)
Closed 7 years ago.
I know how to pull db from android device through adb but i have got few samsung device like S4 adb is not working. when I run
run-as packagename
It says package does not exist and it works in other devices.
Any idea why it is happening like that??
You can also get the db file from Eclipse/studio
Open DDMS ==> File explorer tab
Move to /data/data/your packagename/databases
Select the required .db file and press pull button. (You will find it on top right corner of file explored) and save the file at required location
(OR)
Go to command prompt
c:> adb pull /data/data/your packagename/databases/dbfilename.db savefilelocation(ex: /username/Desktop/x.db)
Related
This question already has answers here:
Retrieve database or any other file from the Internal Storage using run-as
(12 answers)
Closed 3 years ago.
Actually in my application after an intent is sent I create a file called myfile.asc now i'm trying through ADB to pull that file but the issue is that by using
adb pull /data/data/xx.xxx.xxx/files/myfile.asc
or
adb pull /data/data/xx.xxx.xxx/files/myfile.asc C:\Users\me\Desktop\files
it returns
"remote object does not exist"
The path is actually taken from the Android Studio device File Explorer by clicking on the file and copying the path.
You are trying to access the private folder file which is not accessible in non-rooted android device. For that you need to get the adb shell access then provide the permission to access that directory.
For this use case, I have created a library that can help you. It's open-sourced.
https://medium.com/#mohom.r/extracting-android-data-files-of-our-android-app-from-non-rooted-device-be9084ddbdc3
This question already has answers here:
Retrieve database or any other file from the Internal Storage using run-as
(12 answers)
Closed 4 years ago.
In my Android project I use Realm.
Sometimes I need to extract db file from device.
To do this I follow the next steps:
Open console
adb shell
run-as my_project_name_space
cd files
cp my_db_file.realm /sdcard
exit
exit
adb pull sdcard/my_db_file.realm d:\Temp\my_db_file.realm
As result in folder d:\Temp I get db file: my_db_file.realm
Nice. It's work fine.
But when I need again to extract db file I must again do all of this 8 steps.
Has any faster approach?
Something like start script that execute all of this 8 steps. Or or something similar.
Thanks.
In debug apk you can use android studio's device explorer
goto path
/data/data/your-package-name/files/your-db.realm
and by right clicking you can save it without running any kind of code.
This question already has answers here:
Browse SQLite database from Android Studio [closed]
(7 answers)
Closed 5 years ago.
Whenever I run the following line
adb -d shell "run-as com.package.name ls /data/user/0/com.package.name/databases/"
I get the following error
/data/user/0/com.package.name/databases/ no such file or directory
This is how I'm creating the database
public SQLiteHelper(Context context, String DatabaseName) {
super(context, DatabaseName+".db", null, 1);
this.context = context;
this.DatabaseName = DatabaseName+".db";
Log.d(TAG, "DB: " + DatabaseName);
Log.d(TAG, "Path: " + context.getDatabasePath(this.DatabaseName).toString());
}
The Log cat however displays the following
Path: /data/user/0/com.package.name/databases/test1.db
Signaling that the database has been created. Why is the command prompt telling me no such file or directory exists?
Hours ago I entered the line
adb shell pm clear com.package.name
As I wanted to delete the previous databases that I found on the device. But when I started to have problems I simply uninstalled using
adb uninstall com.package.name
However, I'm still experiencing problems. My overall main goal is to simply view the contents of my databases for development purposes. I currently have a Nexus 5 (Android Version 6.0.1 unrooted phone) connected to a PC.
Does anyone have an idea on what the problem might be?
you can see how to create database in android studio in this link,
then for pulling the database out of your application:
1: run your application in your emulator
2: in android studio top menu open Tools --> Android --> Android Device Monitor
3: in the right section of the Android Device Monitor you can find the file explorer with out using any shell script .
4: in data folder find your package name then pull out the db
This question already has answers here:
Retrieve database or any other file from the Internal Storage using run-as
(12 answers)
Closed 7 years ago.
I have a non-rooted Nexus 5 on Android 5.1.
I've tried multiple solutions described here Android ADB access to application databases without root in order to pull a debugable app database from the file system, but to no avail. Has anybody managed to make it work on 5.1 ?
When trying to copy to sdcard, I get cp: /sdcard: Permission denied
When trying to pull the file directly, I get remote object '/data/data/packagename/databases/name.db' does not exist
This question has been successfully answered by Alex P here - android adb, retrieve database using run-as
Here's a quick look at the answer:
the command for Android 5.0+ to save
/data/data/package.name/databases/file would be:
adb exec-out run-as package.name cat databases/file > file
This question already has answers here:
Retrieve database or any other file from the Internal Storage using run-as
(12 answers)
Closed 4 years ago.
I followed the step by step instructions given in the answer of How do I view the SQLite database on an Android device?
1) Connect your device and launch the application in debug mode.
2) Copy the database file from your application folder to your sd
card. You may want to use adb -d shell "run-as com.resmed.mon ls
/data/data/com.resmed.mon/databases/" to see what the database
filename is.
3) adb -d shell "run-as com.yourpackge.name cat
/data/data/com.yourpackge.name/databases/filename.sqlite >
/sdcard/filename.sqlite"
(in my case "/data/data/com.mypackge.name/databases/MyDb")
4) Pull the database files to your machine:
5) adb pull /sdcard/filename.sqlite .
6) Install Firefox SQLLite Manager:
https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/
7) Open Firefox SQLLite Manager (Tools->SQLite Manager) and open your
database file from step 3 above."
But in my case, the database extracted is always empty. When i open the file on SQL Lite Manager, i can't find my tables and my data. I don't understand why. I can see the data on my device screen using my app in debug mode. Is there an other folder where my database could be stored ?
My phone is not rooted.
Thanks for your help.
PS : I wanted to comment on the previous answer, but my reputation is too low to interact with the answer.
I've published a simple shell script for dumping databases:
https://github.com/Pixplicity/dbdump
It performs two distinct methods described here:
First, it tries to make the file accessible for other users, and attempting to pull it from the device.
If that fails, it streams the contents of the file over the terminal to the local machine. It performs an additional trick to remove \r characters that some devices output to the shell.
From here you can use a variety of CLI or GUI SQLite applications, such as sqlite3 or sqlitebrowser, to browse the contents of the database.
As far as I remember, you shouldn't be able to extract a database from un-rooted device. You can however get it from an emulator!