Mới gần đây khi mày mò thêm về React Native thì mình gặp phải một số lỗi liên quan đến ADB cụ thể như sau: Show
Khi mình test thử app thì không thể hoạt động được, gặp đủ lỗi linh tính, vì nhiều quá nên mình không kể ra đây được. Khi mình dùng adb server version (39) doesn’t match this client (36); killing… error: could not install *smartsocket* listener: Address already in use ADB server didn’t ACK * failed to start daemon * và lỗi này adb server is out of date. killing… cannot bind ‘tcp:5037’ ADB server didn’t ACK * failed to start daemon * Cách fix như sau: Bạn bật command lên và chạy lần lượt nhé, nếu cái nào không được thì thêm sudo đằng trước để chạy với quyền super user cp /Android/Sdk/platform-tools/adb /usr/bin/adb chmod +x /usr/bin/adb nano /etc/environment source /.bashrc Cá nhân mình vẫn chưa thực sự hiểu nguyên nhân lắm nhưng vẫn copy ra đây cho các bạn đọc. Bạn nào muốn đọc chi tiết hơn có thể xem tại đây còn cách fix thì ở link này If you have adb installed as part of your Linux distribution, then your PATH probably points there. Chances are this adb is version 1.0.31 (or earlier). Genymotion comes with its own adb in the tools/ directory, which is version 1.0.32 if you are running the latest Genymotion, currently 2.3.1. Unless you changed it in the settings, Genymotion will start the bridge with that copy. Since adb operates in a client-server arrangement, the client version should match the daemon version. In your case, they don’t and that’s why you’re getting the adb server is out of date. killing… message. If the daemon is killed or dies, the Genymotion launcher automatically and immediately restarts adb (using its own copy), and that’s why your client can’t start a new daemon bound to port 5037. The solution is to make sure that the version of adb you are invoking on the command line matches the one that Genymotion is bringing up as a daemon when it starts the VMs. The easiest way to ensure this is just to use the adb binary in Genymotion’s tools/ directory. Note that if you have changed Genymotion’s default of using its own tools to use custom SDK tools, then you’ll need to use an adb client that matches the version contained in the SDK you’re pointing to. As far as I can tell, KitKat (4.4.4) and earlier SDKs contain adb version 1.0.31, while the Lollipop (5.0) SDKs have 1.0.32. Hôm nay mình có làm theo video hướng dẫn up phiên bản 4.4.2 kitkat cho zenfone 5 từ trang sforum.vn của cellphone thì mình phát hiện máy mình bị lỗi: Daemon not running. starting it now on port 5037. hy vọng được các bạn chỉ cách khắc phục để có thể up phiên bản. Android Debug Bridge ( adb kill-server
adb kill-server 7 command facilitates a variety of device actions, such as installing and debugging apps. adb kill-server 7 provides access to a Unix shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components:
adb kill-server 7 is included in the Android SDK Platform Tools package. Download this package with the , which installs it at adb devices -l 2. If you want the standalone Android SDK Platform Tools package, download it here. For information on connecting a device for use over adb kill-server 7, including how to use the Connection Assistant to troubleshoot common problems, see Run apps on a hardware device. How adb worksWhen you start an adb kill-server 7 client, the client first checks whether there is an adb kill-server 7 server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb kill-server 7 clients. Note: All adb kill-server 7 clients use port 5037 to communicate with the adb kill-server 7 server. The server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range 5555 to 5585, which is the range used by the first 16 emulators. Where the server finds an adb kill-server 7 daemon (adbd), it sets up a connection to that port. Each emulator uses a pair of sequential ports — an even-numbered port for console connections and an odd-numbered port for adb kill-server 7 connections. For example: Emulator 1, console: 5554 Emulator 1, adb kill-server 7: 5555 Emulator 2, console: 5556 Emulator 2, adb kill-server 7: 5557 and so on. As shown, the emulator connected to adb kill-server 7 on port 5555 is the same as the emulator whose console listens on port 5554. Once the server has set up connections to all devices, you can use adb kill-server 7 commands to access those devices. Because the server manages connections to devices and handles commands from multiple adb kill-server 7 clients, you can control any device from any client or from a script. Enable adb debugging on your deviceTo use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. On Android 4.2 (API level 17) and higher, the Developer options screen is hidden by default. To make it visible, You can now connect your device with USB. You can verify that your device is connected by executing $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo 6 from the adb devices -l 2 directory. If connected, you'll see the device name listed as a "device." Note: When you connect a device running Android 4.2.2 (API level 17) or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog. For more information about connecting to a device over USB, read Run apps on a hardware device. Connect to a device over Wi-FiNote: The instructions below do not apply to Wear devices running Android 11 (API level 30). See the guide to for more information. Android 11 (API level 30) and higher support deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without ever needing to physically connect your device via USB. This eliminates the need to deal with common USB connection issues, such as driver installation. Before you begin using wireless debugging, do the following:
To use wireless debugging, you must pair your device to your workstation using a QR code or a pairing code. Your workstation and device must be connected to the same wireless network. To connect to your device, follow these steps:
Wi-Fi connection using command lineAlternatively, to connect to your device using command line without Android Studio, follow these steps:
Resolve wireless connection issuesIf you are having issues connecting to your device wirelessly, try the following troubleshooting steps to resolve the issue. Check whether your workstation and device meet the prerequisitesCheck that the workstation and device meet the prerequisites listed at the . Check for other known issuesThe following is a list of current known issues with wireless debugging (with adb or Android Studio) and how to resolve them:
Connect wirelessly with a device after an initial USB connection (only option available on Android 10 and lower)Note: This workflow is applicable also to Android 11 (and higher), the caveat being that it also involves an *initial* connection over physical USB. Note: The following instructions do not apply to Wear devices running Android 10 (API level 29) or lower. See the guide about for more information. adb kill-server 7 usually communicates with the device over USB, but you can also use adb kill-server 7 over Wi-Fi. To connect a device running Android 10 (API level 29) or lower, follow these initial steps over USB:
Note: Beware that not all access points are suitable. You might need to use an access point whose firewall is configured properly to support adb kill-server 7.
Your device is now connected to adb kill-server 7. If the adb kill-server 7 connection to your device is lost:
Query for devicesBefore issuing adb kill-server 7 commands, it is helpful to know what device instances are connected to the adb kill-server 7 server. Generate a list of attached devices using the $ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices List of devices attached emulator-5557 device 4 command: adb devices -l In response, adb kill-server 7 prints this status information for each device:
The following example shows the $ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices List of devices attached emulator-5557 device 4 command and its output. There are three devices running. The first two lines in the list are emulators, and the third line is a hardware device that is attached to the computer. $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo Emulator not listedThe $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo 6 command has a corner-case command sequence that causes running emulators to not show up in the $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo 6 output even though the emulators are visible on your desktop. This happens when all of the following conditions are true:
One way to avoid this situation is to let the emulator choose its own ports and to run no more than 16 emulators at once. Another way is to always start the adb kill-server 7 server before you use the adb install path_to_apk 0 command, as explained in the following examples. Example 1: In the following command sequence, the $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo 6 command starts the adb kill-server 7 server, but the list of devices does not appear. Stop the adb kill-server 7 server and enter the following commands in the order shown. For the AVD name, provide a valid AVD name from your system. To get a list of AVD names, type adb install path_to_apk 9. The adb install path_to_apk 0 command is in the adb connect device_ip_address:5555 01 directory. $ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5555 $ adb devices List of devices attached
Example 2: In the following command sequence, $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo 6 displays the list of devices because the adb kill-server 7 server was started first. To see the emulator in the $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo 6 output, stop the adb kill-server 7 server, and then start it again after using the adb install path_to_apk 0 command and before using the $ adb devices List of devices attached emulator-5556 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86 0a388e93 device usb:1-1 product:razor model:Nexus_7 device:flo 6 command, as follows: $ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices List of devices attached emulator-5557 device For more information about emulator command-line options, see . Send commands to a specific deviceIf multiple devices are running, you must specify the target device when you issue the adb kill-server 7 command. To specify the target, follow these steps:
In the following example, the list of attached devices is obtained, and then the serial number of one of the devices is used to install the adb connect device_ip_address:5555 18 on that device: $ adb devices List of devices attached emulator-5554 device emulator-5555 device 0.0.0.0:6520 device To install on emulator-5555$ adb -s emulator-5555 install helloWorld.apk To install on 0.0.0.0:6520$ adb -s 0.0.0.0:6520 install helloWorld.apk Note: If you issue a command without specifying a target device when multiple devices are available, adb kill-server 7 displays an error "adb: more than one device/emulator". If you have multiple devices available but only one is an emulator, use the adb connect device_ip_address:5555 20 option to send commands to the emulator. If there are multiple devices but only one hardware device attached, use the adb connect device_ip_address:5555 21 option to send commands to the hardware device. Install an appYou can use adb kill-server 7 to install an APK on an emulator or connected device with the adb connect device_ip_address:5555 23 command: adb install path_to_apk You must use the adb connect device_ip_address:5555 24 option with the adb connect device_ip_address:5555 23 command when you install a test APK. For more information, see . To install multiple APKs use adb connect device_ip_address:5555 27. This is useful if you download all the APKs for a specific device for your app from the Play Console and want to install them on an emulator or physical device. For more information about how to create an APK file that you can install on an emulator/device instance, see Build and run your app. Note: If you are using Android Studio, you do not need to use adb kill-server 7 directly to install your app on the emulator or device. Instead, Android Studio handles the packaging and installation of the app for you. Set up port forwardingUse the adb connect device_ip_address:5555 29 command to set up arbitrary port forwarding, which forwards requests on a specific host port to a different port on a device. The following example sets up forwarding of host port 6100 to device port 7100: adb connect device_ip_address:5555 0 The following example sets up forwarding of host port 6100 to local:logd: adb connect device_ip_address:5555 1 This could be useful if you are trying to detemine what is being sent to a given port on the device. All received data will be written to the system-logging daemon and displayed in the device logs. Copy files to and from a deviceUse the adb connect device_ip_address:5555 30 and adb connect device_ip_address:5555 31 commands to copy files to and from a device. Unlike the adb connect device_ip_address:5555 23 command, which only copies an APK file to a specific location, the adb connect device_ip_address:5555 30 and adb connect device_ip_address:5555 31 commands let you copy arbitrary directories and files to any location in a device. To copy a file or directory and its sub-directories from the device, do the following: adb connect device_ip_address:5555 2 To copy a file or directory and its sub-directories to the device, do the following: adb connect device_ip_address:5555 3 Replace adb connect device_ip_address:5555 35 and adb connect device_ip_address:5555 36 with the paths to the target files/directory on your development machine (local) and on the device (remote). For example: adb connect device_ip_address:5555 4 Stop the adb serverIn some cases, you might need to terminate the adb kill-server 7 server process and then restart it to resolve the problem. For example, this could be the case if adb kill-server 7 does not respond to a command. To stop the adb kill-server 7 server, use the adb connect device_ip_address:5555 40 command. You can then restart the server by issuing any other adb kill-server 7 command. Issue adb commandsIssue adb kill-server 7 commands from a command line on your development machine or from a script using the following: adb connect device_ip_address:5555 5 If there's only one emulator running or only one device connected, the adb kill-server 7 command is sent to that device by default. If multiple emulators are running and/or multiple devices are attached, you need to use the adb connect device_ip_address:5555 21, adb connect device_ip_address:5555 20, or adb connect device_ip_address:5555 10 option to specify the target device to which the command should be directed. You can see a detailed list of all supported adb kill-server 7 commands using the following command: adb connect device_ip_address:5555 6 Issue shell commandsYou can use the adb connect device_ip_address:5555 48 command to issue device commands through adb kill-server 7 or to start an interactive shell. To issue a single command, use the adb connect device_ip_address:5555 48 command like this: adb connect device_ip_address:5555 7 To start an interactive shell on a device, use the adb connect device_ip_address:5555 48 command like this: adb connect device_ip_address:5555 8 To exit an interactive shell, press adb connect device_ip_address:5555 52 or type adb connect device_ip_address:5555 53. Android provides most of the usual Unix command-line tools. For a list of available tools, use the following command: adb connect device_ip_address:5555 9 Help is available for most of the commands via the adb connect device_ip_address:5555 54 argument. Many of the shell commands are provided by toybox. General help applicable to all toybox commands is available via adb connect device_ip_address:5555 55. With Android Platform Tools 23 and higher, adb kill-server 7 handles arguments the same way that the adb connect device_ip_address:5555 57 command does. This change has fixed a lot of problems with and makes it possible to safely execute commands that contain shell metacharacters, such as adb connect device_ip_address:5555 58. This change means that the interpretation of any command that contains shell metacharacters has also changed. For example, adb connect device_ip_address:5555 59 is now an error, because the single quotes ( adb connect device_ip_address:5555
adb connect device_ip_address:5555 61. To make the command work, quote twice, once for the local shell and once for the remote shell, as you do with adb connect device_ip_address:5555 57. For example, adb connect device_ip_address:5555 63. See also Logcat command-line tool, which is useful for monitoring the system log. Call activity managerWithin an adb kill-server 7 shell, you can issue commands with the activity manager ( adb connect device_ip_address:5555
While in a shell, the adb connect device_ip_address:5555 65 syntax is: $ adb devices List of devices attached device_ip_address:5555 device 0 You can also issue an activity manager command directly from adb kill-server 7 without entering a remote shell. For example: $ adb devices List of devices attached device_ip_address:5555 device 1 Table 1. Available activity manager commands Command Description adb connect device_ip_address:5555 68 Start an adb connect device_ip_address:5555 69 specified by adb connect device_ip_address:5555 70. See the . Options are:
adb connect device_ip_address:5555 82 Start the adb connect device_ip_address:5555 83 specified by adb connect device_ip_address:5555 70. See the . Options are:
adb connect device_ip_address:5555 86 Force-stop everything associated with adb connect device_ip_address:5555 87. adb connect device_ip_address:5555 88 Kill all processes associated with adb connect device_ip_address:5555 87. This command kills only processes that are safe to kill and that will not impact the user experience. Options are:
adb connect device_ip_address:5555 91 Kill all background processes. adb connect device_ip_address:5555 92 Issue a broadcast intent. See the . Options are:
adb connect device_ip_address:5555 94 Start monitoring with an adb connect device_ip_address:5555 95 instance. Typically the target adb connect device_ip_address:5555 96 is the form adb connect device_ip_address:5555 97. Options are:
$ adb devices List of devices attached device_ip_address:5555 device 10 Start profiler on $ adb devices List of devices attached device_ip_address:5555 device 11, write results to adb connect device_ip_address:5555 74. $ adb devices List of devices attached device_ip_address:5555 device 13 Stop profiler on $ adb devices List of devices attached device_ip_address:5555 device 11. $ adb devices List of devices attached device_ip_address:5555 device 15 Dump the heap of $ adb devices List of devices attached device_ip_address:5555 device 11, write to adb connect device_ip_address:5555 74. Options are:
$ adb devices List of devices attached device_ip_address:5555 device 20 Set app adb connect device_ip_address:5555 87 to debug. Options are:
$ adb devices List of devices attached device_ip_address:5555 device 24 Clear the package previous set for debugging with $ adb devices List of devices attached device_ip_address:5555 device 25. $ adb devices List of devices attached device_ip_address:5555 device 26 Start monitoring for crashes or ANRs. Options are:
$ adb devices List of devices attached device_ip_address:5555 device 29 Control screen compatibility mode of adb connect device_ip_address:5555 87. $ adb devices List of devices attached device_ip_address:5555 device 31 Override device display size. This command is helpful for testing your app across different screen sizes by mimicking a small screen resolution using a device with a large screen, and vice versa. Example: $ adb devices List of devices attached device_ip_address:5555 device 32 $ adb devices List of devices attached device_ip_address:5555 device 33 Override device display density. This command is helpful for testing your app across different screen densities by mimicking a high-density screen environment using a low-density screen, and vice versa. Example: $ adb devices List of devices attached device_ip_address:5555 device 34 $ adb devices List of devices attached device_ip_address:5555 device 35 Print the given intent specification as a URI. See the . $ adb devices List of devices attached device_ip_address:5555 device 36 Print the given intent specification as an $ adb devices List of devices attached device_ip_address:5555 device 37 URI. See the . Specification for intent argumentsFor activity manager commands that take an adb connect device_ip_address:5555 70 argument, you can specify the intent with the following options: Show all $ adb devices List of devices attached device_ip_address:5555 device 39 Specify the intent action, such as $ adb devices List of devices attached device_ip_address:5555 device 40. You can declare this only once. $ adb devices List of devices attached device_ip_address:5555 device 41 Specify the intent data URI, such as $ adb devices List of devices attached device_ip_address:5555 device 42. You can declare this only once. $ adb devices List of devices attached device_ip_address:5555 device 43 Specify the intent MIME type, such as $ adb devices List of devices attached device_ip_address:5555 device 44. You can declare this only once. $ adb devices List of devices attached device_ip_address:5555 device 45 Specify an intent category, such as $ adb devices List of devices attached device_ip_address:5555 device 46. $ adb devices List of devices attached device_ip_address:5555 device 47 Specify the component name with package name prefix to create an explicit intent, such as $ adb devices List of devices attached device_ip_address:5555 device 48. $ adb devices List of devices attached device_ip_address:5555 device 49 Add flags to the intent, as supported by $ adb devices List of devices attached device_ip_address:5555 device 50. $ adb devices List of devices attached device_ip_address:5555 device 51 Add a null extra. This option is not supported for URI intents. $ adb devices List of devices attached device_ip_address:5555 device 52 Add string data as a key-value pair. $ adb devices List of devices attached device_ip_address:5555 device 53 Add boolean data as a key-value pair. $ adb devices List of devices attached device_ip_address:5555 device 54 Add integer data as a key-value pair. $ adb devices List of devices attached device_ip_address:5555 device 55 Add long data as a key-value pair. $ adb devices List of devices attached device_ip_address:5555 device 56 Add float data as a key-value pair. $ adb devices List of devices attached device_ip_address:5555 device 57 Add URI data as a key-value pair. $ adb devices List of devices attached device_ip_address:5555 device 58 Add a component name, which is converted and passed as a $ adb devices List of devices attached device_ip_address:5555 device 59 object. $ adb devices List of devices attached device_ip_address:5555 device 60 Add an array of integers. $ adb devices List of devices attached device_ip_address:5555 device 61 Add an array of longs. $ adb devices List of devices attached device_ip_address:5555 device 62 Add an array of floats. $ adb devices List of devices attached device_ip_address:5555 device 63 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 64. $ adb devices List of devices attached device_ip_address:5555 device 65 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 66. $ adb devices List of devices attached device_ip_address:5555 device 67 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 68. $ adb devices List of devices attached device_ip_address:5555 device 69 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 70. $ adb devices List of devices attached device_ip_address:5555 device 71 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 72. $ adb devices List of devices attached device_ip_address:5555 device 73 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 74. $ adb devices List of devices attached device_ip_address:5555 device 75 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 76. $ adb devices List of devices attached device_ip_address:5555 device 77 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 78. $ adb devices List of devices attached device_ip_address:5555 device 79 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 80. $ adb devices List of devices attached device_ip_address:5555 device 81 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 82. $ adb devices List of devices attached device_ip_address:5555 device 83 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 84. $ adb devices List of devices attached device_ip_address:5555 device 85 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 86. $ adb devices List of devices attached device_ip_address:5555 device 87 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 88. $ adb devices List of devices attached device_ip_address:5555 device 89 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 90. $ adb devices List of devices attached device_ip_address:5555 device 91 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 92. $ adb devices List of devices attached device_ip_address:5555 device 93 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 94. $ adb devices List of devices attached device_ip_address:5555 device 95 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 96. $ adb devices List of devices attached device_ip_address:5555 device 97 Include the flag $ adb devices List of devices attached device_ip_address:5555 device 98. $ adb devices List of devices attached device_ip_address:5555 device 99 Include the flag adb kill-server 00. adb kill-server 01 Include the flag adb kill-server 02. adb kill-server 03 Include the flag adb kill-server 04. adb kill-server 05 Include the flag adb kill-server 06. adb kill-server 07 Requires the use of adb connect device_ip_address:5555 21 and adb connect device_ip_address:5555 24 options to set the intent data and type. adb kill-server 10 You can directly specify a URI, package name, and component name when not qualified by one of the preceding options. When an argument is unqualified, the tool assumes the argument is a URI if it contains a ":" (colon). The tools assumes the argument is a component name if it contains a "/" (forward-slash); otherwise it assumes the argument is a package name. Call package manager (adb kill-server 11) Within an adb kill-server 7 shell, you can issue commands with the package manager ( adb kill-server
While in a shell, the adb kill-server 11 syntax is: $ adb devices List of devices attached device_ip_address:5555 device 2 You can also issue a package manager command directly from adb kill-server 7 without entering a remote shell. For example: $ adb devices List of devices attached device_ip_address:5555 device 3 Table 2. Available package manager commands Command Description adb kill-server 16 Print all packages, optionally only those whose package name contains the text in adb kill-server 17. Options:
adb kill-server 26 Print all known permission groups. adb kill-server 27 Print all known permissions, optionally only those in adb kill-server 28. Options:
adb kill-server 34 List all test packages. Options:
adb kill-server 37 Print all features of the system. adb kill-server 38 Print all the libraries supported by the current device. adb kill-server 39 Print all users on the system. adb kill-server 40 Print the path to the APK of the given adb connect device_ip_address:5555 87. adb kill-server 42 Install a package, specified by adb kill-server 43, to the system. Options:
adb kill-server 62 Removes a package from the system. Options:
adb kill-server 66 Delete all data associated with a package. adb kill-server 67 Enable the given package or component (written as "package/class"). adb kill-server 68 Disable the given package or component (written as "package/class"). adb kill-server 69 Options:
adb kill-server 71 Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. adb kill-server 72 Revoke a permission from an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app. adb kill-server 73 Change the default install location. Location values:
Note: This is only intended for debugging. Using this can cause apps to break and other undesireable behavior. adb kill-server 77 Returns the current install location. Return values:
adb kill-server 81 Specify whether the given permission should be enforced. adb kill-server 82 Trim cache files to reach the given free space. adb kill-server 83 Create a new user with the given adb kill-server 84, printing the new user identifier of the user. adb kill-server 85 Remove the user with the given adb kill-server 86, deleting all data associated with that user adb kill-server 87 Print the maximum number of users supported by the device. adb kill-server 88 Print the domain verification state for the given package, or for all packages if none is specified. State codes are defined as follows:
Options are:
adb kill-server 99 Reset domain verification state for the given package, or for all packages if none is specified.
Options are:
adb devices -l 02 Broadcast a verification request for the given package, or for all packages if none is specified. Only sends if the package has previously not recorded a response.
adb devices -l 04 Manually set the state of a domain for a package. The domain must be declared by the package as autoVerify for this to work. This command will not report a failure for domains that could not be applied.
adb devices -l 12 Manually set the state of a host user selection for a package. The domain must be declared by the package for this to work. This command will not report a failure for domains that could not be applied.
adb devices -l 12 Manually set the state of a host user selection for a package. The domain must be declared by the package for this to work. This command will not report a failure for domains that could not be applied.
adb devices -l 22 Toggle the auto-verified link-handling setting for a package.
adb devices -l 26 Print the owners for a specific domain for a given user in low- to high-priority order.
Call device policy manager (adb devices -l 30) To help you develop and test your device management apps, issue commands to the device policy manager ( adb devices -l
While in a shell, the adb devices -l 30syntax is: $ adb devices List of devices attached device_ip_address:5555 device 4 You can also issue a device policy manager command directly from adb kill-server 7 without entering a remote shell: $ adb devices List of devices attached device_ip_address:5555 device 5 Table 3. Available device policy manager commands Command Description adb devices -l 34 Sets component as active admin. Options are:
adb devices -l 37 Set component as active admin and its package as profile owner for an existing user. Options are:
adb devices -l 41 Set component as active admin and its package as device owner. Options are:
adb devices -l 45 Disable an active admin. The app must declare adb devices -l 46 in the manifest. This command also removes device and profile owners. Options are:
adb devices -l 49 Clear the device's record of previously set freeze periods for system OTA updates. This is useful to avoid the device scheduling restrictions when developing apps that manage freeze periods. See . Supported on devices running Android 9.0 (API level 28) and higher. adb devices -l 50 Force the system to make any existing network logs ready for retrieval by a DPC. If there are connection or DNS logs available, the DPC receives the adb devices -l 51 callback. See . This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. adb devices -l 52 Force the system to make any existing security logs available to the DPC. If there are logs available, the DPC receives the adb devices -l 53 callback. See . This command is rate-limited. Supported on devices running Android 9.0 (API level 28) and higher. Take a screenshotThe adb devices -l 54 command is a shell utility for taking a screenshot of a device display. While in a shell, the adb devices -l 54 syntax is: $ adb devices List of devices attached device_ip_address:5555 device 6 To use adb devices -l 54 from the command line, enter the following: $ adb devices List of devices attached device_ip_address:5555 device 7 Here's an example screenshot session, using the adb kill-server 7 shell to capture the screenshot and the adb connect device_ip_address:5555 30 command to download the file from the device: $ adb devices List of devices attached device_ip_address:5555 device 8 Record a videoThe adb devices -l 59 command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file. You can use this file to create promotional or training videos or for debugging and testing. In a shell, use the following syntax: $ adb devices List of devices attached device_ip_address:5555 device 9 To use adb devices -l 59 from the command line, enter the following: adb kill-server 0 Stop the screen recording by pressing Control+C. Otherwise, the recording stops automatically at three minutes or the time limit set by adb devices -l 61. To begin recording your device screen, run the adb devices -l 59 command to record the video. Then, run the adb connect device_ip_address:5555 30 command to download the video from the device to the host computer. Here's an example recording session: adb kill-server 1 The adb devices -l 59 utility can record at any supported resolution and bit rate you request, while retaining the aspect ratio of the device display. The utility records at the native display resolution and orientation by default, with a maximum length of three minutes. Limitations of the adb devices -l 59 utility:
Table 4. adb devices -l 59 options Options Description adb connect device_ip_address:5555 54 Display command syntax and options adb devices -l 68 Set the video size: adb devices -l 69. The default value is the device's native display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder. adb devices -l 70 Set the video bit rate for the video, in megabits per second. The default value is 20Mbps. You can increase the bit rate to improve video quality, but doing so results in larger movie files. The following example sets the recording bit rate to 6Mbps: adb kill-server 2 adb devices -l 71 Set the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes). adb devices -l 72 Rotate the output 90 degrees. This feature is experimental. adb devices -l 73 Display log information on the command-line screen. If you do not set this option, the utility does not display any information while running. Read ART profiles for appsStarting in Android 7.0 (API level 24), the Android Runtime (ART) collects execution profiles for installed apps, which are used to optimize app performance. Examine the collected profiles to understand which methods are executed frequently and which classes are used during app startup. Note: It is only possible to retrieve the execution profile filename if you have root access to the file system, for example, on an emulator. To produce a text form of the profile information, use the following command: adb kill-server 3 To retrieve the file produced, use: adb kill-server 4 Reset test devicesIf you test your app across multiple test devices, it may be useful to reset your device between tests, for example, to remove user data and reset the test environment. You can perform a factory reset of a test device running Android 10 (API level 29) or higher using the adb devices -l 74 adb kill-server 7 shell command, as shown: adb kill-server 5 When restoring the device using adb devices -l 74, the device automatically backs up the RSA key that allows debugging through the current workstation in a persistent location. That is, after the device is reset, the workstation can continue to debug and issue adb kill-server 7 commands to the device without manually registering a new key. Additionally, to help make it easier and more secure to keep testing your app, using the adb devices -l 74 to restore a device also changes the following device settings:
If your app needs to detect and adapt to the default settings of the adb devices -l 74 command, use the . sqliteadb devices -l 81 starts the adb devices -l 82 command-line program for examining SQLite databases. It includes commands such as adb devices -l 83 to print the contents of a table and adb devices -l 84 to print the adb devices -l 85 statement for an existing table. You can also execute SQLite commands from the command line, as shown: adb kill-server 6 Note: It is only possible to access a SQLite database if you have root access to the file system, for example, on an emulator. For more information, see the adb devices -l 81 command line documentation. adb USB backendsThe adb server can interact with the USB stack through two backends. It can either use the native backend of the OS (Windows, Linux, or macOS) or it can use the adb devices -l 87 backend. Some features, such as adb devices -l 88, adb devices -l 89, and USB speed detection, are only available when using adb devices -l 87 backend. You can choose a backend by using the adb devices -l 91 environment variable. If it isn't set, adb uses its default backend. The default behavior varies among OS. Starting with API level 34, the native backend is used by default. If adb devices -l 91 is set, it determines whether the native backend or adb devices -l 87 is used. See the adb manual page for more information about adb environment variables. adb mDNS backendsADB can use the multicast DNS protocol to automatically connect the server and devices. The ADB server ships with two backends, Bonjour (Apple's mdnsResponder) and Openscreen. The Bonjour backend needs a daemon to be running on the host machine. On macOS Apple's built-in daemon is always running, but on Windows and Linux, the user must make sure the adb devices -l 94 daemon is up and running. If the command adb devices -l 95 returns an error, it is likely that ADB is using the Bonjour backend but there is no Bonjour daemon running. The Openscreen backend does not need a daemon to be running on the machine. Support for the Openscreen backend on macOS starts at ADB v35. Windows and Linux are supported as of ADB v34. By default ADB uses the Bonjour backend. This behavior can be changed using the environment variable adb devices -l 96 (set to adb kill-server 51 or adb kill-server 50). See the ADB manual page for further details. |