Android learning note _ 60_Android ADB commands

Source: Internet
Author: User

Part 1:

1. Configure the environment anroid variable in ubuntu:

Run sudo gedit/etc/profile on the terminal to open the text editor and append # set android environment

2. To run Eclipse, you also need to configure JAVA environment variables.

# Set java environment

JAVA_HOME =/home/loginname/jdk directory name

JRE_HOME =/home/loginname/jdk directory name/jre

Export PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH

Export CLASSPATH = $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH

Export PATH =/home/loginname/android-sdk-linux_86/tools: $ PATH

After saving, restart

3. Add the device ID to the current android debugging environment

Add the device ID of the android terminal to the/home/loginname/. android file.

4. Update the sdk

[Android update sdk] updates the sdk.

5. Common commands:

[Adb help] get help

[Adb get-serialno] get the device serial number

[Adb root] obtaining root permissions is useful for some mobile phones. Most listed mobile phones have disabled this function. You can also obtain the root permission through a third-party tool such as the bean clip.

[Adb kill-server] kills the server process of adb.

[Adb start-server] starts the server process of adb.

[Adb devices] view the android terminal that establishes the connection.

[Android list] displays all android Terminals

[Ddms] Start ddms

Adb remount: Reload the hard disk.

[Adb reboot] restarts the terminal.

[Adb install/path/appname] install the application

[Adb uninstall com. android. helloworld] uninstall helloworld. Applications in the system cannot be uninstalled.

[Adb push/sourcepath/filename/destinationpath/filename] copy a file from the pc end to the terminal

[Adb pull/sourcepath/filename/destinationpath/filename] copy a file from the terminal to the pc end

[Adb logcat-v time-s TAGNAME] displays the custom TAGNAME and time

[Adb ppp] Start ppp through usb

[Adb monkey-p/path/appname-v 100] forcibly tests the program for 100 times.

Adb shell: Start the shell command terminal on the pc.

The preceding Command requires the root permission on the pc. If the command fails, you can try to switch the working directory to the sdk tools, for example, sudo. /adb kill-server, sudo. /adb start-server.

6. Use the following command in shell:

[Am start-n {package name}/{package name}. {activity name}] start the activity of an app. For configuration reference, see AndroidManifest. xml, for example, alarm:
# Am start-n com. android. alarmclock/com. android. alarmclock. AlarmClock

[Am broadcast-a android. intent. action. ActionName] sends a broadcast message.

Setprop key value: Set the property value of the key.

[Getprop KEY] Get the property value of this key

[Getevent] get all events

[Watchprops] monitors changes in the property value.

[Stop SERVER] forcibly stops a service

[Start SERVER] starts a service.

[Ioctl] Control Device

Dumpsys activity: displays activity stack information.

[Top] displays the resource usage and other information of instantaneous processes.

[Free] displays the memory usage of the current process.

[Ps] displays the identity information of a process.

Rm/path/filename: delete an object from the terminal.

[Mkdir] create a directory or file

[Grep] search for specific content

[Ls] displays files in the current directory

[Cd] switch the current directory

[Chmod] change file attributes

[Cp] copy an object

[Dd] copy an object

[Mv] Move or rename a directory file

[Cat] View File Content

[Kill] kills the process

[Ipconfig] view and change the network interface address and Parameters

[Ping] checks the network status

[Netstat] view the network status

Telnet

[Sqlite3/path/DATABASENAME. db] Open a database. Then you can use database operation commands such as select, insert, and delete.

[Tcpdump-p-nnn-vvv-s 0-w/PATH/NAME. pcap port 80 and tcp] network debugging packet capture

[Gst-launch playbin uri = file: // system/media/audio/bootaudioaudio] gst Multimedia Framework for playing audio files

[Alsa_amixer] Audio debugging command. You can switch audio channels, adjust the volume, and switch devices. Different chip manufacturers have different parameter settings.

[Alsa_aplay-D AndroidPlayback_Speaker_normal/cache/music/dial/0.wav] Play the pcm code stream through alsa.

[Alsa_arecord] recording through alsa

[Am start-n com. android. music/com. android. music. MediaPlaybackActivity-d/sdcard/bootaudiolistener] start the android process to play mp3

[Stack -- symbols-dir =./out/target/product/NAME/symbols ramdump] view the call stack

[Exit] exit shell

Using adb shell, cd/system/bin, ls can list most of the available commands.

7. VenderID of Some android phones

#0x0525 NXP Chip

#0x18D1 Broadcom2457 dual-card chip

#0x2314 GHT Moke

#0x04E8 AnyCall GT-I5508

#0x22B8 Moto XT701 XT300

#0x0BB4 HTC A8180


Part 2:

Adb (Android Debug Bridge) is a common tool for Android users. With this tool, we can develop very well. adb.exe is under the android sdk tools directory you have installed,

Adb usage:

Adb [-d |-e |-s <serialNumber>] <command>

When you issue a command, the system enables the Android client. The client is not related to the simulator instance, so if the dual server/device is running, you need to use the-d option to determine the target instance for the command to be controlled. For more information about using this option, you can view the terms control commands of the simulator/device instance.

1. Install the application to the simulator: You can use adb to copy an application from your development computer and install it on a simulator/device instance. Run the install command. This installcommand requires you to specify the path of the .apk file to be installed: adb install <path_to_apk> to obtain more information about how to create a .apk file that can be installed on the simulator/device, see Android Asset Packaging Tool (aapt ). note that if you are using Eclipse IDE and have installed the ADT plug-in, you do not need to directly use adb (or aapt) to install the application on the simulator/device. Otherwise, the ADT plug-in handles application packaging and installation on your behalf. to delete an application, follow these steps: test: adb shellcd/data/apprm test.apk 2. Enter the device or simulator shell: adb shell, you can enter the shell environment of the device or simulator. In this Linux Shell, You can execute various Linux commands. If you only want to execute a shell command, you can use the following method: adb shell [command] such as adb shell dmesg will print the kernel debugging information. 3. Release port: You can set any port number as the request port from the host to the simulator or device. For example, adb forward tcp: 5555 tcp: 80004. Import or copy files from the simulator/device: You can use adbpull, the push Command copies the file to a data file of the simulator/device instance or from the data file. The installcommand only copies a .apk file to a specific location. Unlike the command, the pull and push commands allow you to copy arbitrary directories and files to any location of a simulator/device instance. Copy a file or directory from a simulator or device. Run the following command: adb pull <remote> <local> to copy the file or directory to the simulator or device. Run the following command) adb push <local> <remote> in these commands, <local> and <remote> respectively refer to their own development machine (local) and simulator/device instance (remote) path of the target file/directory on
1-t 1-n Android_1.1-t 2-n Android_1.5-t 3-23/4-sdcard <directory/sdcard. img>-avd <Virtual Machine Name>-sdcard D:/sdcard. img-avd "Android_1.5" 56/record.txt/7-"info" is a tag, which is the output statement set when you use the Log class: Log. I ("info", "have a test ")

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.