Run commands in Android adb

Source: Internet
Author: User

As an open-source system, the Android mobile phone operating system is favored by developers. We can modify this in the simulator of this system to achieve our own goal. For example, you can use a debugging tool such as Android adb to compile the interface graphics.

  • Basic concepts of Android floating point
  • Android Performance Comparison of advantages and disadvantages in actual development
  • In-depth analysis of Android code structure
  • Concepts related to Android screen elements
  • Android Virtual Devices apply to your deployment goals

Android's main debugging tool adb (Android debuging bridge), ddms is a graphical Tool Based on adb.

Android adb is a command line tool. Ddms features the same as adb, but it has a graphical interface. It is a good choice for people who do not like the current operation method.

These commands are stored in the tools directory of the Android sdk. These commands can be run in both linux and Windows.

First, make sure that a simulator is started on the local machine. Run the following command to check whether the simulator has been started:

 
 
  1. adb devices   
  2. List of devices attached   
  3. emulator-5554 device   
  4. emulator-5556 device  

Returns a simulator of 5554.

Install an application on the simulator and run the adb install command.

 
 
  1. adb install /home/myname/test.apk 

T in Android adb, test.apk is a packaged application.

The installed program can be found in the simulator directory/system/app using the adb shell command. The file name is the same as that installed.

File transmission: You can use adb pull and adb push to transfer files between a PC and a simulator.

Adb pull Copies files from the simulator to the PC. The usage is as follows:

 
 
  1. adb pull < remote> < local>  

Remote indicates the file path of the simulator, and local indicates the file path of the PC.

For example, adb pull/system/app/test.apk/home/myname/test.apk

Adb push returns the file from the PC to the simulator, and push can copy all the task files to the simulator, if you upload an apk file to/system/app/, the function is the same as that of adb install. Usage

 
 
  1. adb push < local> < remote> 

Everyone understands that Android is an operating system platform. When a simulator is started, an operating system is started. You can use Android adb to connect to the operating system and run some system commands, just as you usually access a remote linux/unix server through a terminal. You can use adb shell. Run the ls command after the following shell. In this shell, you can run some common commands in linux. Note: adb shell only starts one emulator, if multiple simulators are started, for example, if the adb devices command is used to return two simulators, if you want to connect one of them, add the parameter-s: use the example: adb-s emulator-5554 shell.

 
 
  1. adb shell   
  2. # ls   
  3. sqlite_stmt_journals   
  4. cache   
  5. sdcard   
  6. etc   
  7. init   
  8. init.goldfish.rc   
  9. init.rc   
  10. data   
  11. sys   
  12. system   
  13. proc   
  14. default.prop   
  15. sbin   
  16. root   
  17. dev   
  18. #  

Android adb deletes a file. If you use the adb shell to directly access the file and use the rm command to delete the file, the file cannot be deleted. Run adb remount before the adb shell command

 
 
  1. $adb remount;  
  2. $adb shell  

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.