ユーザ用ツール

サイト用ツール


サイドバー

android:adb

adb(Android Debug Bridge)

よく使うadbのコマンド

# 接続機器一覧
> adb devices
List of devices attached
FA88H1F00864    device
emulator-5554   device
 
# 実機のログ確認
> adb -s FA88H1F00864 logcat -s neko:*
--------- beginning of main
--------- beginning of system
--------- beginning of crash
 
# 端末に接続する
>adb shell
error: more than one device/emulator // 複数接続している場合は指定する必要がある
 
# 端末IDの確認
>adb devices
List of devices attached
FA88H1F00999    device
emulator-5554   device
 
# 端末を指定して接続する
>adb -s emulator-5554 shell
generic_x86:/ $
 
# rootを取得する ※rootを取得できるイメージは決まっている ⇒ rootを取得するには参照
>adb root
 
# 必要か不明
>adb remount
Not running as root. Try "adb root" first.
 
# sqlite3
>adb shell
#cd /data/data/[パッケージ名]/databases
#sqlite3 xxxx.db

SQLite コマンド

# DBオープン
# sqlite3 TestDB.db

# テーブル一覧表示
qlite> .tables

# テーブルの構造確認
sqlite> select * from sqlite_master;
table|android_metadata|android_metadata|3|CREATE TABLE android_metadata (locale TEXT)
table|level|level|4|CREATE TABLE level (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    type INTEGER,
    type_name text,
    level INTEGER,
    lock INTEGER,
    comp INTEGER,
    score INTEGER
    )

# 終了
sqlite> .exit
sqlite> .quit

rootを取得するには

>adb root
>adb remount
Not running as root. Try "adb root" first.

や

Permission denied

や

generic_x86:/ $ // $マーク

の場合はrootが取得できていない。

adb rootでrootを取得するためには、「Google APIs」のimageを選択したエミュレーターを使用する必要がある。

SDK Managerでのインストール

Show Package Detailにチェックをいれ
「Google APIs Intel x86 Atom_64 System Image」
をインストールする

android/adb.txt · 最終更新: 2019/11/15 06:59 by ips