23

Are there any way to access the files in /data/data and copy them into memory card? I do not have root access.

Sid
  • 4,176
  • 9
  • 35
  • 60
user2463482
  • 331
  • 1
  • 2
  • 3

1 Answers1

40

Without root access you have 2 options. Both options (may) allow you to access the files for a particular app, e.g. the folder /data/data/com.app.packagename.

  1. If the application is debuggable you can use the run-as command in adb shell (more info about what adb is and how to install it can be found here)

    adb shell
    run-as com.your.packagename` 
    cp /data/data/com.app.packagename/
    
  2. If the application is not debuggable, you can use Android's backup function.

    adb backup -noapk com.app.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 the app's 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.

xavier_fakerat
  • 10,065
  • 6
  • 41
  • 101
THelper
  • 956
  • 12
  • 27
  • 4
    Does this also apply to applications with android:allowbackup="false"? – Key-Six Jan 09 '15 at 09:40
  • 2
    @Drejon No, I don't think it will work in that case (but I haven't tested it, so I am not 100% sure). – THelper Jan 09 '15 at 10:54
  • 2
    I am sure there are some cases of application that don't allow backup. When creating backup of all apps, they simply backup nothing. AFAIK, some app might provide a restricted subset of files or maybe even something custom, so don't consider it as always 1:1 of the directory in /data/data. BTW, BlackBerry forces me to use some password, but it is possible to decrypt it (if you have the password). I think I have used https://sourceforge.net/projects/adbextractor/ for that. – v6ak Mar 13 '18 at 20:56
  • 3
    I managed to get it with

    adb backup -noapk com.app.packagename

    You will get backup.ab then you will need to convert to tar (to open it with 7zip) You can convert it with https://sourceforge.net/projects/adbextractor/ - there is jar inside thi called abe.jar. Then You can run command

    java -jar abe.jar unpack backup.ab backup.tar

    – Igor Vuković Jun 10 '19 at 08:01
  • 6
    If adb backup produces a tiny (41-47 byte) file, then it may be that the APK is marked as allowBackup=0. Run aapt dump xmltree whatever.apk AndroidManifest.xml | grep allowBackup. – Jonathon Reinhart May 04 '20 at 00:10
  • According to the Android Documentation, you can't disable device-to-device migration of your app's files, so even with allowBackup="false", you can back up to a secondary device of your choice (i.e. a rooted one) and get the files from there. – Bip901 May 26 '23 at 13:12