Last active
January 26, 2016 07:14
-
-
Save granoeste/c98c670d17e6b2ce2a6e to your computer and use it in GitHub Desktop.
get database from your debug app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 実機に接続 | |
$ adb shell | |
# コピー先の空ファイルを作成 | |
$ touch /data/local/tmp/mydatabase.db | |
# アプリにrun-as | |
$ run-as [package] | |
$ cd databases | |
# ファイルコピー | |
$ dd if=mydatabase.db of=/data/local/tmp/mydatabase.db | |
# run-as からexit | |
$ exit | |
# adb からexit | |
$ exit | |
# ファイルをpull | |
$ adb pull /data/local/tmp/mydatabase.db . | |
# まとめて実行するばあい | |
export DATABSE=mydatabase.db | |
export PACKAGE=com.example.app | |
adb shell touch /data/local/tmp/${DATABSE} | |
adb shell run-as ${PACKAGE} dd if=/data/data/${PACKAGE}/databases/${DATABSE} of=/data/local/tmp/${DATABSE} | |
adb pull /data/local/tmp/${DATABSE} . | |
open ${DATABSE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment