赞
踩
1)adb(android调试桥)是android工具包中的一个特殊工具,
必须有一个正在运行的模拟器或连接了一个android设备,adb才能工作。以下为在powershell中的测试:
PS D:\android-sdk-windows\platform-tools> .\adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
2)查看当前可用的虚拟设备
PS D:\android-sdk-windows\tools> .\android list avd
Available Android Virtual Devices:
如果没有设备,通过SDK Manager配置一下
配置完毕后,可以看到虚拟设备的结果
PS D:\android-sdk-windows\tools> .\android list avd
Available Android Virtual Devices:
Name: mytest
Path: C:\Users\deepfuture\.android\avd\mytest.avd
Target: Android 2.2 (API level 8)
Skin: WVGA800
Sdcard: 32M
PS D:\android-sdk-windows\tools>
3)手动启动模拟器
PS D:\android-sdk-windows\tools> .\emulator -avd mytest
4)再开一个powershell窗口
用adb进行调试
先查看是否检测到虚拟设备正在运行
PS D:\android-sdk-windows\platform-tools> .\adb devices
List of devices attached
emulator-5554 device
然后连接设备
PS D:\android-sdk-windows\platform-tools> .\adb shell
查看设备当前目录
# ls
ls
config
cache
sdcard
acct
mnt
d
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
5)查看可操作的命令集
# ls /system/bin
ls /system/bin
run-as
gdbserver
showlease
ifconfig
pppd
kill
applypatch_static
ndc
fsck_msdos
netstat
ps
netd
sendevent
sync
flash_image
servicemanager
schedtest
rild
updater
chmod
ioctl
input
notify
6)查看整体目录结构
# cd /
cd /
# ls -l
ls -l
dr-x------ root root 2011-05-09 14:18 config
drwxrwx--- system cache 2011-05-09 14:18 cache
lrwxrwxrwx root root 2011-05-09 14:18 sdcard -> /mnt/sdcard
drwxr-xr-x root root 2011-05-09 14:18 acct
drwxrwxr-x root system 2011-05-09 14:18 mnt
lrwxrwxrwx root root 2011-05-09 14:18 d -> /sys/kernel/debug
lrwxrwxrwx root root 2011-05-09 14:18 etc -> /system/etc
drwxr-xr-x root root 2010-06-30 21:06 system
drwxr-xr-x root root 1970-01-01 00:00 sys
drwxr-x--- root root 1970-01-01 00:00 sbin
dr-xr-xr-x root root 1970-01-01 00:00 proc
-rwxr-x--- root root 12995 1970-01-01 00:00 init.rc
-rwxr-x--- root root 1677 1970-01-01 00:00 init.goldfish.rc
-rwxr-x--- root root 107412 1970-01-01 00:00 init
-rw-r--r-- root root 118 1970-01-01 00:00 default.prop
drwxrwx--x system system 2011-05-09 14:20 data
drwx------ root root 2010-01-28 00:59 root
drwxr-xr-x root root 2011-05-09 14:19 dev
7)查看设备安装的包列表
# ls /data/data
ls /data/data
com.android.gesture.builder
com.example.android.apis
com.example.android.softkeyboard
com.example.android.livecubes
com.android.term
com.android.email
com.android.sdksetup
com.svox.pico
8)查看包列表中的各包所含数据库文件:*.db为sqlite数据库
# ls /data/data/com.android.providers.contacts/databases
ls /data/data/com.android.providers.contacts/databases
contacts2.db
#
9)登录sqlite,直接操作
比如查看数据库中的表
# sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db
sqlite3 /data/data/com.android.providers.contacts/databases/contacts2.db
SQLite version 3.6.22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
.tables
_sync_state settings
_sync_state_metadata status_updates
accounts v1_settings
activities view_contacts
agg_exceptions view_contacts_restricted
android_metadata view_data
calls view_data_restricted
contact_entities_view view_groups
contact_entities_view_restricted view_raw_contacts
contacts view_raw_contacts_restricted
data view_v1_contact_methods
groups view_v1_extensions
mimetypes view_v1_group_membership
name_lookup view_v1_groups
nickname_lookup view_v1_organizations
packages view_v1_people
phone_lookup view_v1_phones
properties view_v1_photos
raw_contacts
10)输出表的create语句
sqlite> .schema calls
.schema calls
CREATE TABLE calls (_id INTEGER PRIMARY KEY AUTOINCREMENT,number TEXT,date INTEGER,duration INTEGER,type INTEGER,new IN
EGER,name TEXT,numbertype INTEGER,numberlabel TEXT);
sqlite>
11)sql语句
sqlite> select count(*) from data;
select count(*) from data;
count(*)
0
sqlite>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。