1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Androidアプリ内で作ったデータベースを確認したい

Posted at

はじめに

Androidのバージョンによって、方法が異なる(っぽい)
細かい検証はしていないが、簡単に言うとAndroid7(くらい)で出来ていた方法が、機種変更した(Android8)ら出来なくなった。
色々調べる前に、ひとまず確認できた方法をメモしておく。

Android7あたりまで出来ていた方法

adb shell
run-as [パッケージ名]
cp databases/[データベース名].db /[端末のアクセスできる場所]/[データベース名].db
exit
exit
adb pull /[端末のアクセスできる場所]/[データベース名].db C:\[ローカルの適当なパス]\[データベース名].db

Android8.0.0でとりあえず出来た方法

adb shell "run-as [パッケージ名] chmod 777 /data/data/[パッケージ名]/databases/[データベース名].db"
adb shell "cat data/data/[パッケージ名]/databases/[データベース名].db > /[端末のアクセスできる場所]/[データベース名].db"
adb pull /[端末のアクセスできる場所]/[データベース名].db C:\[ローカルの適当なパス]\[データベース名].db
  • chmod 666だと、パーミッション足りないって言われた
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?