is it possible to see application data from adb shell the same way I see it mounting SD card?

后端 未结 3 2040
再見小時候
再見小時候 2020-12-04 15:45

I am testing an Android application.
I would like to keep an eye on the content of

/sdcard/Android/data/com.myapplication   

whi

相关标签:
3条回答
  • 2020-12-04 15:58

    I have been able to get the Sqlite DB the App is using with this Adb command:

    adb exec-out run-as xxx.xxx.xxx.xxx cat "/data/data/xxx.xxx.xxx.xxx/databases/databasefile.db" > %userprofile%\Desktop\databasefile.db
    

    Where xxx.xxx.xxx.xxx is the bundleId of your Android App, and databasefile.db is the name of the Sqlite DB

    So I imagine you can get any existing file of the App, knowing where is it, and using the adb exec-out run-as xxx.xxx.xxx.xxx command

    0 讨论(0)
  • 2020-12-04 16:05

    As a general rule, files that are on the Internal storage and stored by your app (by default not WORLD_READABLE) will only be available for your application to read. When you try to pull these files using adb pull you will get permission denied on a NOT rooted device. There is a way to go around this, I will explain later. Files in External storage on the other hand, are available to the User and to all other apps to read. so it depends on what you are after.

    Now in order to read files in your internal storage (/data/data/com.app.name) you cannot read these files directly, but what you can do is move them to the external storage and then read them from there like this.

    adb shell "run-as com.yourappName cat /data/data/com.yourappName/files/myfile.txt > /sdcard/Downloads/myfile.txt"
    

    Then you can pull the file from the external storage with no permission issues.

    adb pull /sdcard/Downloads/myfile.txt
    

    If you are unsure about which file or you want to browse all the files, then user the shell to browse all your app files.

    adb shell
    run-as yourappPackageName
    cd /data/data/youappPackageName
    ls -all
    
    0 讨论(0)
  • 2020-12-04 16:17

    You can access it via utility which was posted earlier in a blog. Its a java utility through which you can get the all folders in your application's data folder by just giving the package name of your application. Just app needs to be debuggable.

    Extract Android Files

    Really works

    0 讨论(0)
提交回复
热议问题