$ adb shell
error: insufficient permissions for device
$ adb devices
List of devices attached
???????????? no permissions
修改
/etc/udev/rules.d/51-android.rules为
SUBSYSTEM=="usb",ENV{DEVTYPE}=="usb_device",MODE="0666"
这样修改,可以识别所有USB设备
断开USB链接,重新插上即可
$ adb push framework-res.apk system/framework/framework-res.apk
failed to copy 'framework-res.apk' to 'system/framework/framework-res.apk': Read-only file system
$ adb remount
remount succeeded
$ adb push framework-res.apk system/framework/framework-res.apk
1186 KB/s (3978588 bytes in 3.274s)
以下内容摘自http://developer.android.com/guide/developing/tools/adb.html
1. Android Debug Bridge
communicate with an emulator instance or connected Android-powered device
a client-server program
2. three components
A client, runs on your development machine
A server, runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device
A daemon, runs as a background process on each emulator or device instance
3. <sdk>/platform-tools/
4. all adb clients use port 5037 to communicate with the adb server
Issuing adb Commands
adb [-d|-e|-s <serialNumber>] <command>
if multiple emulators/devices are running, you need to use the -d option to specify the target instance to which the command should be directed
Querying for Emulator/Devices Instances
adb devices
generate a list of attached emulators/devices
[serialNumber] [state]
state:offline, device
$ adb devices
List of devices attached
0123456789ABCDEF
device
emulator-5554
offline
$ adb devices
List of devices attached
0123456789ABCDEF
device
emulator-5554
device
Directing Commands to a Specific Emulator/Device Instance
if multiple emulator/device instances are running
adb -s <serialNumber> <command>
adb -s emulator-5554 install helloworld.apk
Installing an Application
adb install <path_to_apk>
Forwarding Ports
不知道有什么作用
Copying Files to or from an Emulator/Device Instance
To copy a file or directory (recursively) from the emulator or device
add pull <remote> <local>
To copy to
add push <local> <remote>
local:your development machine
remote:emulator/device instance
Listing of adb Commands
Category
Command
Description
Options
-d
Direct an adb command to the only attached USB device
-e
-s <serialNumber>
General
devices
Prints a list of all attached emulator/device instances
help
Prints a list of supported adb commands
version
Prints the adb version number
Debug
logcat [<option>] [<filter-specs>]
Prints log data to the screen
bugreport
Prints dumpsys, dumpstate, and logcat data to the screen, for the purposes of bug reporting
jdwp
Prints a list of available JDWP processes on a given device
Data
install <path-to-apk>
pull <remote> <local>
push <local> <remote>
Ports and Networking
忽略,forward, ppp
Scripting
get-serialno
get-state
wait-for-device
Blocks execution until the device is online, you can prepend this command to other adb
commands. This command does not cause adb to wait until the entire system si fully booted
For that reason, you should not prepend it to other commands that require a fully booted
system.
adb wait-for-device shell getprop
adb wait-for-device install <app>.apk, requires Android package manager
Server
start-server
Checks whether the adb server process is running and starts it, if no
kill-server
Terminates the adb server process
Shell
shell
Starts a remote shell in the target emulator/device instance
shell [<shellCommand>]
Issues a shell command in the target emulator/device instance and then exit the remote shell
Issuing Shell Commands
The command binaries are stored in the file system of the emulator or device, in this location
/system/bin/...
ctrl+d or exit:end the shell session
Examining sqlite3 Databases from a Remote Shell
you can use the sqlite3 command-line program to manage SQLite databases created by Android applications
Emulator/device instances store SQLite3 databases in the folder
/data/data/<package_name>/databases/
$ adb shell
# sqlite3 DBpath
UI/Application Exerciser Monkey
generates paeudo-random streams of user events
you can use the Monkey to stress-test applications in a random yet repeatable manner
$ adb shell monkey -v -p your.package.name 500
For more information about commant options for Monkey, see the Complete UI/Application Exerciser Monkey dcumentation page
Other Shell Commands
adb -help
adb shell ls /system/bin
Shell Command
Description
dumpsys
Dumps system data to the screen
dumpstate
Dumps state to a file
logcat [<option>]...[<filter-spec>]
dmesg
Prints kernel debugging messages to the screen
start
Starts (restarts) an emulator/device instance
stop
Stops execution of an emulator/device instance