I have been trying to pull out the sqlite database from my sony xperia android device (OS: JellyBean 4.1.2), I have looked into different stackoverflow threads in some cases I am getting error
"run-as: Package 'com.myapp' is unknown",
in some cases mydata.db file shows up in my computer directory but with zero kb size. Is there any proper way of pulling database out ? Is there any guide from google for this purpose ?
Note I have already visited following thread :
android adb, retrieve database using run-as

- 1
- 1

- 2,162
- 2
- 19
- 39
-
you cannot pull database if the device is not rooted in your device OS, my suggestion is to copy the database on to your sdcard (http://stackoverflow.com/questions/14957835/copy-sqlite-database-for-android-application) if its your code. – Piyush Jun 08 '16 at 06:50
-
Check out my answer on the duplicate question. If should be simplest way to do what you want. – Xaver Kapeller Jun 09 '16 at 09:36
2 Answers
If I understood correctly, you can use adb pull <path-to-db-on-phone> <path-on-your-pc>
. In case you get any permission error : do adb remount
and then try the above command again.

- 7,944
- 12
- 78
- 165
-
Did not worked, I tried this one getting "pull: building file list... 0 files pulled. 0 files skipped." – Harsh Shah Jun 08 '16 at 06:47
-
adb pull command gives permission denied error then adb remount gives operation not permitted, do you have any idea why this is happening ? – Harsh Shah Jun 08 '16 at 11:00
-
@HarshShah : There may be permission problem. See this : http://stackoverflow.com/questions/2078710/android-adb-access-to-application-databases-without-root – Naveen Jun 08 '16 at 13:44
I found a solution.
First run this command
adb backup -f ~/data.ab -noapk app.package.name[![enter image description here][1]][1]
Just click on "Back up my data" button. The screen will display the name of the package you're backing up, then close by itself upon successful completion.
The resulting ".ab" file contains application data in android backup format.
To quickly extract a simple non-encrypted backup run:
dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf -
It is possible that not all openssl installations are compiled with zlib support. Here's an alternative one-liner that makes use of python to achieve the same result:
dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
The result is the apps/app.package.name/ folder containing application data.
Note: This method doesn't work if application developer has explicitly disabled ability to backup his app by setting android:allowBackup="false" in the application manifest.
Check this link: http://blog.shvetsov.com/2013/02/access-android-app-data-without-root.html

- 2,162
- 2
- 19
- 39