SuperIC社区_
标题: 常用的adb命令 [打印本页]
作者: sean 时间: 2016-9-28 20:19
标题: 常用的adb命令
首先把adb配置到环境变量中注意添加Java跟android环境变量;
ADB连接板子:
设置Root权限:shell@android:/#su
板子上的mac地址最好重新配下,如:shell@android:/#busybox ifconfig eth0 hw ether00:88:88:00:00:0a
开始adb:shell@android:/#startadbd
获取板卡IP地址:#busybox ifconfig
shell@android:/ #busybox ifconfig
eth0 Link encap:Ethernet HWaddr 00:88:88:00:00:0A
inetaddr:169.254.1.73 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::288:88ff:fe00:1/64Scope
ink UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:84 errors:0 dropped:0overruns:0 frame:0
TX packets:3772 errors:0 dropped:0overruns:0 carrier:0
collisi**:0 txqueuelen:30
RX bytes:20217 (19.7 KiB) TX bytes:1459734 (1.3 MiB)
Interrupt:201 Base address:0x4000
lo Link encap
ocal Loopback inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8029 errors:0 dropped:0overruns:0 frame:0
TX packets:8029 errors:0 dropped:0overruns:0 carrier:0
collisi**:0 txqueuelen:0
RX bytes:681842 (665.8 KiB) TX bytes:681842 (665.8 KiB)
shell@android:/ #
Step 4: 网线连接板子和电脑,在Dos下输入:
开启adb服务 adb start-server
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb disconnect
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb connect 169.254.1.73:5555
设置成功的话,就能在eclipse下run APK在板子上跑了。
(3)server的命令:
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb kill-server
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb start-server
(4)Install Apk:
安装第三方应用:
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb installE:\HelloWorld.apk
应用将被安装到data/app
安装系统应用:
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb shell
shell@android:/#mount -o remount rw system
shell@android:/#chmod 777 system/app
退出adb shell(CTRL+c),然后:
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb push E:\MLauncher.apksystem/app
(5)Uninstall Apk:
方法1:
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb uninstallpackage---->adb uninstall com.example.helloandroid(helloandroid.apk包名)
方法2:
卸载第三方应用
C:\Documents andSettings\Administrator\android-sdks\platform-tools>adb shell
shell@android:/# su
shell@android:/ #rm-rf data/app/package-1.apk
卸载系统应用:
shell@android:/# su
shell@android:/#mount -o remount rw system
shell@android:/#chmod 777 system/app
shell@android:/#rm system/app/XXX.apk
(6)Android Debug Bridge version 1.0.29
-d - directs commandto the only connected USB device
returns anerror if more than one USB device is present.
-e - directs commandto the only running emulator.
returns anerror if more than one emulator is running.
-s <serial number> - directs command to the USB deviceor emulator with
the givenserial number. Overrides ANDROID_SERIAL
environmentvariable.
-p <product name or path> - simple product name like 'sooner', or
arelative/absolute path to a product
out directorylike 'out/target/product/sooner'.
If -p is notspecified, the ANDROID_PRODUCT_OUT
environmentvariable is used, which must
be an absolutepath.
devices - list all connecteddevices
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 isused by default if no port number is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 isused by default if no port number is specified.
Using thiscommand with no additional arguments
willdisconnect from all connected TCP/IP devices.
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(-l means listbut don't copy)
(see 'adb helpall')
adb shell - run remote shellinteractively
adb shell <command> - run remote shell command
adb emu <command> - run emulator c**ole command
adb logcat [ <filter-spec> ] - Viewdevice log
adb forward <local> <remote> -forward socket connecti**
forward specsare one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socketname>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp - list PIDs of processeshosting a JDWP transport
adb install [-l] [-r] [-s] [--algo<algorithm name> --key <hex-encoded key> --iv <hex-encodediv>] <file>
- push thispackage file to the device and install it
('-l' meansforward-lock the app)
('-r' meansreinstall the app, keeping its data)
('-s' means install on SD cardinstead of internal storage)
('--algo','--key', and '--iv' mean the file is encrypted already)
adb uninstall [-k] <package> - removethis app package from the device
('-k' means keep the dataand cache directories)
adb bugreport - return all information fromthe device
that should beincluded in a bug report.
adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared][-all] [-system|-nosystem] [<packages...>]
- write anarchive of the device's data to <file>.
If no -foption is supplied then the data is wr
itten
to "backup.ab" in the currentdirectory.
(-apk|-noapkenable/disable backup of the .apks themselves
in thearchive; the default is noapk.)
(-shared|-nosharedenable/disable backup of the device's
sharedstorage / SD card contents; the default is noshared.)
(-all means toback up all installed applicati**)
(-system|-nosystem toggles whether -allautomatically includes
systemapplicati**; the default is to include system apps)
(<packages...> is the list of applicati** to be backed up. If
the -all or-shared flags are passed, then the package
list isoptional. Applicati** explicitly givenon the
commandline will be included even if -nosystem would
ordinarilycause them to be omitted.)
adb restore <file> - restore device contents from the<file> backup archive
adb help - show this help message
adb version - show version num
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a serverrunning
adb kill-server - kill the server if it isrunning
adb get-state - prints: offline | bootloader| device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device statusfor a specified device
adb remount - remounts the /systempartition on the device read-write
adb reboot [bootloader|recovery] - rebootsthe device, optionally into the bootloader or recovery program
adb reboot-bootloader - reboots the device into thebootloader
adb root - restarts the adbd daemonwith root permissi**
adb usb - restarts the adbddaemon listening on USB
adb tcpip <port> - restarts the adbd daemonlistening on TCP on the specified port
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPPconnection.
<tty> refers to the tty for PPP stream.Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dumplocal notty usepeerdns
adb sync notes: adbsync [ <directory> ]
<localdir> can be interpreted inseveral ways:
- If <directory> is not specified, both/system and /data partiti** will be updated.
- If it is "system" or"data", only the corresponding partition is updated.
environmentalvariables:
ADB_TRACE - Print debug information.A comma separated list of the following values
1 or all, adb,sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
ANDROID_SERIAL - The serial number to connectto. -s takes priority over this if given.
ANDROID_LOG_TAGS - When used with the logcatoption, only these debug tags are printed.
欢迎光临 SuperIC社区_ (/) |
Powered by Discuz! X3.3 |