sqlite3 permission denied android

前端 未结 4 1100
再見小時候
再見小時候 2021-02-13 22:19

I\'m trying to access the database of the application I\'m developping directly on my Nexus, but I get a \"permission denied\" when I tried to execute the \"sqlite3\" command. I

4条回答
  •  -上瘾入骨i
    2021-02-13 22:53

    I struggled with this for a while, so here's my solution, which works on an unrooted device:

    #!/bin/sh
    
    # fill these values in
    PACKAGE=com.example.android
    DB=something.db 
    
    # copy db to sdcard using package permission (using cat because no cp    command)
    adb shell "run-as $PACKAGE cat /data/data/$PACKAGE/databases/$DB >   /sdcard/$DB"
    
    # pull file from sd card
    adb pull /sdcard/$DB
    
    # do something with it (need to install sqlitebrowser obviously)
    sqlitebrowser $DB
    

提交回复
热议问题