Android ADB access to application databases without root

后端 未结 5 768
难免孤独
难免孤独 2020-12-02 05:20

Can anyone tell me, is it possible to use the ADB to pull and push a database from an app, without root privileges on the phone?

For example, I know the location on

5条回答
  •  無奈伤痛
    2020-12-02 05:43

    On OxygenOS (based on Android 5.2) I've mixed up the two solutions provided by Pilot_51.

    First I've used run-as to gain access on /data/data/package.name/databases from here I wasn't able to copy directly on /sdcard/ hence I changed the permission of the file. After that I've exited from run-as mode and used cp to copy the file in /sdcard/ storage. Eventually I was able to use adb pull

    $ adb -s  shell
    $ run-as package.name
    $ chmod 666 databases/dbname.db
    $ exit
    $ cp /data/data/package.name/databases/dbname.db /sdcard/dbname.db
    $ exit
    $ adb pull /sdcard/dbname.db ./dbname.db
    

提交回复
热议问题