Basic commands of adb (android debugging Bridge) in windows (continuous update ...), Adbandroid
At the beginning, I started to learn about android (I insisted on taking one note every day). The more practical command is adb. So I learned this first, mainly through real machine debugging. The simulator uses genymotion, therefore, emulator is not needed for the time being.
1. View Simulators/connected devices:
By default, all adb clients use port 5037 to communicate with the adb service. Each simulator/device instance requires a pair of consecutive ports: An even port is used for console connection, and an odd port is used for adb connection.
(Sometimes adb cannot be started. Check whether the port number is occupied: netstat-aon | findstr "5037" and obtain the pid; tasklist-aon | findstr "pid" to obtain the process using this port;
A lot of software will be occupied, so you can modify the adb port: Add ANDROID_ADB_SERVER_PORT = "XXX" in "system variables );
Adb device: displays the list of simulators/devices currently connected. Input: serial number (device type and port number) and status (offline), device (connected. ---> Only indicates that the device is currently in the connection status, and does not indicate that the device has been started. -------------- Real machine connection
2. Specify the simulator/device instance to perform some action: Adb-s <name> <command>:
Install the application: adb-s <name> install <apk include path>: install is followed by the apk location to be installed on the simulator/device, find the apk to install ---> install the software on the specified device
After success, check that the desktop of the device has been installed successfully. ^_^
Based on the above information, and then use the ES file browser (the mobile phone opens the root permission for this software) to view: data/local/tmp issued the existing software, so we can speculate: first download the apk to the local tmp folder and then install it;
3. copy the file of the simulator/device instance:
Adb pull <device> <local> --------> transfers the files in the device (either the SD card or the internal storage space of the mobile phone is acceptable, as long as the specified location exists) push to a specified local (Computer) Location
Transmit data from local storage to mobile storage:
Adb push <local> <device> -------------> adb push d: // TestApk // testChinese.pdf/storage/emulated/0/ninarming ----- (transfer from computer to internal storage of mobile phone) -- If the transmitted data is Chinese, the Red Rice mobile phone (connected with Red Rice 1 s) cannot be identified, but the shell is recognized, and letters or numbers are supported.
Pull and push:
Pull --> is there a sense of pulling data from the cloud, and the device can be compared to the cloud, because it can be remote, not connected via usb, it can be accessed remotely through wireless connections. Therefore, pull is used for the computer (local) where files are stored from the device to the current cmd machine (local) --> adb pull <romote> <local>;
Push ---> push up, Because cmd is the computer you operate (local), relatively horizontal plane, and device --> cloud is above sea level, if you want to push the file up, you need to push the drive, so adb push <local> <romote>
4. Go to shell:
Adb shell -----------> enter shell,
Exit -----------------> exit shell
A. The following figure shows the file ls in the specified directory after entering the shell;
B. Create the mkdir testMakeDir folder;
C. Check whether the creation is successful;
D. Delete the specified folder rmdir testMakeDir;
E. Check whether the deletion is successful. Then exit.