Tuesday, 3 November 2015

android how to get sharedpreferences files on your android devices





http://stackoverflow.com/questions/13006315/how-to-access-data-data-folder-in-android-device



  1. If the application is debuggable you can use the run-as command in adb shell
    adb shell
    run-as com.your.packagename 
    cp /data/data/com.your.pacakagename/
  2. You can use Android's backup function.
    adb backup -noapk com.your.packagename
    You will now be prompted to 'unlock your device and confirm the backup operation'. It's best NOT to provide a password, otherwise it becomes more difficult to read the data. Just click on 'backup my data'. The resulting 'backup.ab' file on your computer contains all application data in android backup format. Basically it's a compressed tar file. This page explains how you can use OpenSSL's zlib command to uncompress it. You can use the adb restore backup.db command to restore the backup.
Please not give password when you see this file:





However if your app is not debuggable you can only use the first solution.

Then, you will get a backup.ab file, you need a program to open this file.


You can get all you needs here:
https://github.com/nelenkov/android-backup-extractor

but the introduction of this project makes people confuse.

On this github project, this is just source code and libs for compiling those files. after you compiled the source code the output jar files will help you to unzip the backup.ab file.


To compile the source code you should first download this project (on github https://github.com/nelenkov/android-backup-extractor).

then you should download the latest bcprov-jdk15on-xxx.jar file. and put it into  lib folder (the lib folder of the downloaded project: android-backup-extractor-master)

Then you can use ant to compile or by gradlew. (you can chose any of these)

option 1: if you have ant you can compile:

run: ant

that's all, but you may need change your ant script: (build.xml)

change the bcprov file name. (because you may get different versions)

then you will get abe.jar.


then you can unzip your backup.ab file by:

java -jar abe.jar pack|unpack|pack-kk <backup.ab> <backup.tar> [password]


option2: if you want to use gradlew:

just run : ./gradlew.

then you will get abe-all.jar

then you can unzip your backup.ab file by:

java -jar build/libs/abe-all.jar pack|unpack|pack-kk <backup.ab> <backup.tar> [password]








useful links:

http://nelenkov.blogspot.co.uk/2012/06/unpacking-android-backups.html




































No comments:

Post a comment