In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
1.1 introduction to Adb
Adb (android debug bridge) is a tool that comes with android sdk.
Adb is a bridge used to connect the android device and the PC side. Through the adb tool, users can operate the phone comprehensively on the PC side.
The original intention of Android is to use a tool like adb to help developers debug apk faster and better in the process of developing android applications, so adb has the functions of installing and uninstalling apk, copying push files, viewing device hardware information, viewing application resources, executing shell commands on the device, and so on.
Adb can be cross-platform, which means you can use the adb command not only on windows but also on mac/linux platform. You only need to download and configure the corresponding platform software package.
Adb has three main components:
Client (client)
Running on your own computer, you can call up a client through shell
Server (server)
Running in the background of the computer, responsible for managing the communication between client and damon
Daemon (damon)
Run in the background of a simulator or android device
The Adb tool is located in the platform-tools directory under the SDK directory and has three files related to adb:
We have already deployed adb when building an automated environment, and we have used it directly in windows's dos environment (you can enter it by typing cmd in the run), so let's start to introduce how to use adb.
Tips:adb operates android devices through commands.
1.2 Adb common command series
Adb-help
View the help manual
Adb devices
Check out the android devices connected to PC. This is one of the commands we use most frequently. Here is one thing to note:
There is a difference between the Android simulator and the real android device connection if you are using the genymotion simulator because the simulator is already set up
So the genymotion simulator will automatically load the connection adb for you, and we can detect it directly through the adb devices command, but if you are using a Night God / seahorse play simulator, these will not automatically connect you.
So we need to connect manually through the command adb connect, for example, the Night God is adb connect 127.0.0.1 62001.
(here 127.0.0.1 represents the local ip address, which any computer has, and 62001 represents the port number of the Night God simulator.)
If you are a seahorse simulator, then the port number can be changed to 26944.
If it is a real android device (phone / tablet):
1. Make sure your phone is connected to the computer through the USB cable
2. Install your android phone driver through driver software, driver wizard / driver life, etc.
3. Go to the phone, find the settings-> about the phone-> Click the version number five times-> Open the corresponding developer options (Note: due to different phone models, such as Xiaomi, Meizu, Huawei, etc., there may be slightly different ways to open them. If you are not clear, how to open your own phone developer options)
4. Exit to the previous menu, go to the developer option, and find the USB debugging simulator to open it.
5. There is the last step. Generally speaking, there will be a dialog box to confirm debugging. We also need to check it, otherwise the adb command will not be used.
Adb shell
Log in to the device shell (the man-machine interface of the command line) and you can use many linux-related commands in the current environment, such as cd, ls, cp, etc., which is equivalent to executing commands remotely.
Adb pull
Pull the information from the mobile phone and put it on the local computer. The mobile phone path can be entered into the shell environment through adb shell, and the corresponding files can be found through the commands such as cd and ls. For example, pull and put the apk QQ to the test directory under disk D.
Adb push
Push messages locally to mobile phones, such as
Adb install * .apk
To obtain the address of the installation package for apk, you can drag apk directly to the cmd window to obtain it. If you return success, the installation is successful.
Adb install-r * .apk
Retain data and cache files and reinstall apk
Adb shell dumpsys activity | find "mFocusedActivity"
Check the foreground application package name and class name (here we have a general idea of what the package name is: the identity given to the application by the android system)
Adb uninstall
After uninstalling an application, you need to add the corresponding package name.
Adb uninstall-k
Uninstall the application to retain data and cache files
Adb kill-server
Terminate the adb service
Adb start-server
Start the adb service. Usually when there is a problem with adb, restart the adb service together with kill-server.
Adb shell pm list packages
List all package names in the current system
-s lists the system apk path and package name
-3 list user apk and package name
Adb logcat
Grab the android log, which is also a very useful command for us. Through the logcat log, when an exception occurs in the app, such as crash/ does not respond, you can locate the corresponding information in the logcat.
Adb connect/disconnect
By debugging remotely through WiFi, we can connect the phone to the computer without using the USB cable, but we should pay attention to the following:
1. Make sure the phone and the computer are on the same network (the same router connected)
2. Determine the port number of the communication through adb tcpip 5555 in advance.
3. Connect via adb connect plus the ip address of your mobile phone.
If you want to cancel the connection, just use the adb disconnect command.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.