Article Directory
-
-
- I. Introduction
- Two, the simulator connection port summary
- Three, ADB commonly used commands
-
- 1 Connect command
- 2 Check the device connection
- 3 Transfer files or folders on the computer to the simulator
- 4 Transfer files or folders in the simulator to the computer
- 5 Install APK
- 6 Uninstall APK
- 7 Get all package names of the simulator
- 8 Get all package names of the simulator and include the APK path
- 9 Get the APK path corresponding to the package name
- 10 Clean up application data
- 11 Start the application
- 12 Close the app
- 13 analog input
- 14 Simulation button
- 15 Simulate mouse click
- 16 Simulate mouse sliding
- 17 Screenshot
- 18 Get the port number
-
I. Introduction
If you perform automated testing, we can choose an emulator without a real machine. There are many emulators on the market at present, they adb
all have different default ports when they use the connection. When the adb
emulator cannot be automatically connected, use the ip+端口
connection manually .
Two, the simulator connection port summary
Emulator | adb connection code | Simulated organ network |
---|---|---|
NetEase Mumu | adb connect 127.0.0.1:7555 | http://mumu.163.com/ |
Night god | adb connect 127.0.0.1:62001 | https://www.yeshen.com/ |
Happy | adb connect 127.0.0.1:21503 | https://www.xyaz.cn/ |
Tencent Mobile Games Assistant | adb connect 127.0.0.1:5555 | https://syzs.qq.com/sempage/mrzh/index.html |
day by day | adb connect 127.0.0.1:6555 | http://www.ttmnq.com/ |
Seahorse playing | adb connect 127.0.0.1:26744 | http://www.haimawan.com/ |
BlueStacks | adb connect 127.0.0.1:5555 | https://www.bluestacks.cn/ |
Thunder and lightning | adb connect 127.0.0.1:5555 | http://www.ldmnq.com/ldy/baidu.html |
Genymotion | adb connect 127.0.0.1:5555 | https://www.genymotion.com/ |
iTools | adb connect 127.0.0.1:54001 | http://www.itools.cn/ |
Three, ADB commonly used commands
1 Connect command
adb.exe connect 127.0.0.1:21503
2 Check the device connection
adb.exe devices
adb kill-server
adb start-server
adb remount
3 Transfer files or folders on the computer to the simulator
adb push D:/1.avi /mnt/avi/
4 Transfer files or folders in the simulator to the computer
adb pull /mnt/avi/sex.avi D:/avi/
5 Install APK
adb install d:\\qq.apk
6 Uninstall APK
adb uninstall 包名
For example, uninstall QQ:
adb uninstall com.tencent.mobileqq
7 Get all package names of the simulator
adb shell pm list packages
8 Get all package names of the simulator and include the APK path
adb shell pm list packages -f
9 Get the APK path corresponding to the package name
adb shell pm path packageName
10 Clean up application data
adb shell pm clear packageName
11 Start the application
adb shell am start -n 包名/Activity类名
Example: Start the application treasure:
adb shell am start -n com.tencent.android.qqdownloader/com.tencent.assistant.activity.SplashActivity
Specify the simulator to start the mobile application treasure:
adb -s 127.0.0.1:5555 shell am start -n com.tencent.android.qqdownloader/com.tencent.assistant.activity.SplashActivity
12 Close the app
adb shell am force-stop 包名
13 analog input
adb shell input text 字符串(不支持中文)
14 Simulation button
adb shell input keyevent 键值
15 Simulate mouse click
adb shell input tap X Y
16 Simulate mouse sliding
adb shell input swipe X1 Y1 X2 Y2
17 Screenshot
adb shell screencap -p /sdcard/screencap.png
18 Get the port number
This command is not adb
a command, but it is also very commonly used
netstat |findstr 127.0.0.1