To Be Mad Ship One Menaul Is It You Know Have Listen to It

Android Debug Bridge (adb) is a versatile command-line tool that lets yous communicate with a device. The adb command facilitates a variety of device actions, such every bit installing and debugging apps, and it provides admission to a Unix shell that yous tin can utilize to run a diverseness of commands on a device. Information technology is a client-server program that includes three components:

  • A customer, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
  • A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
  • A server, which manages communication between the client and the daemon. The server runs as a background process on your evolution machine.

adb is included in the Android SDK Platform-Tools bundle. You tin download this package with the SDK Managing director, which installs it at android_sdk/platform-tools/. Or if you want the standalone Android SDK Platform-Tools package, you tin download it here.

For information on connecting a device for use over ADB, including how to use the Connectedness Assistant to troubleshoot mutual problems, come across Run apps on a hardware device.

How adb works

When you lot start an adb client, the customer first checks whether there is an adb 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 clients—all adb clients use port 5037 to communicate with the adb server.

The server then sets up connections to all running devices. Information technology locates emulators by scanning odd-numbered ports in the range 5555 to 5585, the range used by the outset 16 emulators. Where the server finds an adb daemon (adbd), information technology sets upward a connection to that port. Note that each emulator uses a pair of sequential ports — an fifty-fifty-numbered port for panel connections and an odd-numbered port for adb connections. For example:

Emulator i, panel: 5554
Emulator ane, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557
and and so on...

As shown, the emulator connected to adb on port 5555 is the aforementioned as the emulator whose panel listens on port 5554.

In one case the server has set up connections to all devices, you can utilize adb commands to access those devices. Considering the server manages connections to devices and handles commands from multiple adb clients, you can command whatever device from any client (or from a script).

Enable adb debugging on your device

To employ adb with a device connected over USB, y'all must enable USB debugging in the device system settings, under Programmer options. To use adb with a device continued over Wi-Fi, encounter Connect to a device over Wi-Fi.

On Android 4.ii and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number 7 times. Return to the previous screen to find Developer options at the bottom.

On some devices, the Developer options screen might be located or named differently.

You can at present connect your device with USB. You can verify that your device is connected by executing adb devices from the android_sdk/platform-tools/ directory. If connected, you lot'll meet the device proper noun listed every bit a "device."

Notation: When you connect a device running Android four.2.2 or higher, the arrangement shows a dialog request 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 admit 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-Fi (Android xi+)

Notation: The instructions below do not apply to Wear devices running Android 11. Come across the guide to debugging a Wear Os app for more data.

Android 11 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 physically connecting your device via USB. This eliminates the demand to deal with mutual USB connection problems, such as commuter installation.

Before you lot begin using wireless debugging, you must consummate the following steps:

  1. Ensure that your workstation and device are connected to the same wireless network.

  2. Ensure that your device is running Android 11 or higher. For more informaton, run into Check & update your Android version.

  3. Ensure that you have Android Studio Bumblebee. You tin can download information technology hither.

  4. On your workstation, update to the latest version of the SDK Platform-Tools.

To employ wireless debugging, you must pair your device to your workstation using a QR Lawmaking or a pairing lawmaking. Your workstation and device must be continued to the same wireless network. To connect to your device, follow these steps:

  1. Enable programmer options on your device:

    1. On your device, find the Build number option. You lot can discover this in the following locations for the following devices:

      Device Setting

      Google Pixel

      Settings > Nigh phone > Build number

      Samsung Galaxy S8 and afterward

      Settings > About phone > Software information > Build number

      LG G6 and subsequently

      Settings > Most telephone > Software info > Build number

      HTC U11 and later

      Settings > About > Software information > More than > Build number or Settings > System > About phone > Software information > More > Build number

      OnePlus 5T and later

      Settings > Near phone > Build number

    2. Tap the Build Number pick 7 times until you see the message You are now a developer! This enables developer options on your phone.

  2. Enable debugging over Wi-Fi on your device:

    1. On your device, discover Programmer options. Y'all can observe this choice in the following locations for the following devices:

      Device Setting

      Google Pixel, OnePlus 5T and after

      Settings > System > Programmer options

      Samsung Galaxy S8 and later, LG G6 and later, HTC U11 and later on

      Settings > Programmer options

    2. In Developer options, scroll down to the Debugging department and plow on Wireless debugging. On the Let wireless debugging on this network? popup, select Permit.

  3. Open Android Studio and select Pair Devices Using Wi-Fi from the run configurations dropdown card.

    Run configurations dropdown menu

    Figure 1. Run configurations dropdown card.

    The Pair devices over Wi-Fi window pops up, equally shown beneath.

    Screenshot of the pair devices over Wi-Fi popup window

    Figure ii. Popup window to pair devices using QR code or pairing code

  4. On your device, tap on Wireless debugging and pair your device:

    Screenshot of            a pixel phone showing the Wireless debugging systems setting.

    Figure 3. Screenshot of the Wireless debugging setting on a Google Pixel phone.

    1. To pair your device with a QR code, select Pair device with QR code and browse the QR lawmaking obtained from the Pair devices over Wi-Fi popup above.

    2. To pair your device with a pairing code, select Pair device with pairing code from the Pair devices over Wi-Fi popup above. On your device, select Pair using pairing code and take notation of the six digit pin code. Once your device appears on the Pair devices over Wi-Fi window, yous can select Pair and enter the half dozen digit pin code shown on your device.

      Screenshot of example pin code entry

      Figure 4. Example of six digit pin code entry.

  5. After you are paired, you can attempt to deploy your app to your device.

    To pair a unlike device or to forget this device on your workstation, navigate to Wireless debugging on your device, tap on your workstation name under Paired devices, and select Forget.

  6. If you want to rapidly turn on and off wireless debugging, you can utilize the Quick settings developer tiles for Wireless debugging, found in Developer Options > Quick settings developer tiles.

    Screenshot of            Quick settings developer tiles from a Google Pixel phone.

    Figure v. The Quick settings developer tiles setting allows you lot to quickly turn wireless debugging on and off.

    Alternatively, to connect to your device via command line without Android Studio, follow these steps:

    1. Enable developer options on your device, every bit described above.

    2. Enable Wireless debugging on your device, as described higher up.

    3. On your workstation, open a terminal window and navigate to android_sdk/platform-tools.

    4. Discover your IP address, port number, and pairing code by selecting Pair device with pairing code. Have notation of the IP address, port number, and pairing code displayed on the device.

    5. On your workstation'south concluding, run adb pair ipaddr:port. Use the IP address and port number from above.

    6. When prompted, enter the pairing code, equally shown beneath.

      Screenshot of            pairing on the command line.

      Figure half dozen. A message indicates that your device has been successfully paired.

Connect to a device over Wi-Fi (Android 10 and lower)

Note: The instructions beneath do not apply to Wear devices running Android 10 (or lower). Encounter the guide to debugging a Wear Bone app for more data.

adb usually communicates with the device over USB, simply y'all tin can as well use adb over Wi-Fi. To connect a device running Android 10 or lower, there are some initial steps you must do over USB, as described beneath:

  1. Connect your Android device and adb host computer to a common Wi-Fi network accessible to both. Beware that not all access points are suitable; you might need to apply an access signal whose firewall is configured properly to back up adb.
  2. If you are connecting to a Wearable Os device, plough off Bluetooth on the telephone that'southward paired with the device.
  3. Connect the device to the host calculator with a USB cablevision.
  4. Set the target device to listen for a TCP/IP connectedness on port 5555.
    adb tcpip 5555            
  5. Disconnect the USB cable from the target device.
  6. Find the IP address of the Android device. For example, on a Nexus device, y'all tin can find the IP address at Settings > About tablet (or Virtually telephone) > Status > IP address. Or, on a Wear Os device, you lot tin find the IP address at Settings > Wi-Fi Settings > Avant-garde > IP address.
  7. Connect to the device by its IP address.
    adb connect              device_ip_address:5555            
  8. Ostend that your host computer is continued to the target device:
    $ adb devices List of devices attached              device_ip_address:5555 device            

Yous're at present good to go!

If the adb connectedness is ever lost:

  1. Make sure that your host is nevertheless continued to the aforementioned Wi-Fi network your Android device is.
  2. Reconnect past executing the adb connect step again.
  3. Or if that doesn't work, reset your adb host:
    adb kill-server            

    Then start over from the kickoff.

Query for devices

Earlier issuing adb commands, it is helpful to know what device instances are continued to the adb server. Y'all tin can generate a list of attached devices using the devices control.

          adb devices -50        

In response, adb prints this condition information for each device:

  • Serial number: A string created by adb to uniquely place the device by its port number. Here's an instance serial number: emulator-5554
  • Land: The connection country of the device tin be one of the following:
    • offline: The device is not connected to adb or is not responding.
    • device: The device is now connected to the adb server. Notation that this state does non imply that the Android system is fully booted and operational considering the device connects to adb while the organization is nevertheless booting. However, after boot-up, this is the normal operational state of an device.
    • no device: There is no device connected.
  • Description: If you include the -l option, the devices command tells yous what the device is. This information is helpful when yous have multiple devices connected so that you can tell them apart.

The following instance shows the devices command and its output. There are iii devices running. The first 2 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 fastened 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 non listed

The adb devices command has a corner-instance command sequence that causes running emulator(s) to not show up in the adb devices output even though the emulator(s) are visible on your desktop. This happens when all of the following conditions are true:

  1. The adb server is non running, and
  2. You utilise the emulator command with the -port or -ports option with an odd-numbered port value between 5554 and 5584, and
  3. The odd-numbered port y'all chose is non busy so the port connectedness can exist made at the specified port number, or if information technology is busy, the emulator switches to some other port that meets the requirements in 2, and
  4. Yous start the adb server later you lot start the emulator.

One way to avert this state of affairs is to let the emulator choose its own ports, and don't run more than 16 emulators at one time. Another fashion is to always outset the adb server before you utilize the emulator control, equally explained in the following examples.

Example 1: In the following control sequence, the adb devices command starts the adb server, only the listing of devices does not appear.

Stop the adb server and enter the following commands in the social club shown. For the avd name, provide a valid avd name from your system. To get a list of avd names, type emulator -list-avds. The emulator control is in the android_sdk/tools directory.

$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5555 $ adb devices  Listing of devices fastened * daemon not running. starting information technology at present on port 5037 * * daemon started successfully *        

Example 2: In the following command sequence, adb devices displays the listing of devices because the adb server was started showtime.

To see the emulator in the adb devices output, stop the adb server, and and so start information technology over again later on using the emulator control and earlier using the adb devices command, as follows:

$ adb kill-server $ emulator -avd Nexus_6_API_25 -port 5557 $ adb start-server $ adb devices  Listing of devices attached emulator-5557 device        

For more information near emulator command-line options, see Using Control Line Parameters.

Send commands to a specific device

If multiple devices are running, you must specify the target device when yous consequence the adb command. To specify the target, apply the devices command to get the serial number of the target. Once you lot have the series number, use the -s option with the adb commands to specify the series number. If y'all're going to issue a lot of adb commands, you can set the $ANDROID_SERIAL environment variable to contain the serial number instead. If you lot utilize both -south and $ANDROID_SERIAL, -south overrides $ANDROID_SERIAL.

In the following example, the list of attached devices is obtained, and and then the serial number of one of the devices is used to install the helloWorld.apk on that device.

$ adb devices List of devices fastened emulator-5554 device emulator-5555 device  $ adb -south emulator-5555 install helloWorld.apk        

Note: If yous upshot a command without specifying a target device when multiple devices are available, adb generates an error.

If you accept multiple devices bachelor, but only one is an emulator, use the -e option to send commands to the emulator. Besides, if in that location are multiple devices but simply one hardware device attached, use the -d option to transport commands to the hardware device.

Install an app

You tin utilise adb to install an APK on an emulator or connected device with the install command:

adb install          path_to_apk        

You must use the -t option with the install command when you install a test APK. For more information, meet -t.

For more information nigh how to create an APK file that you can install on an emulator/device example, see Build and Run Your App.

Note that, if you are using Android Studio, you practise not need to utilize adb direct to install your app on the emulator/device. Instead, Android Studio handles the packaging and installation of the app for you.

Prepare port forwarding

You can use the forward command to gear up capricious port forwarding, which forwards requests on a specific host port to a different port on a device. The following case sets up forwarding of host port 6100 to device port 7100:

adb forward tcp:6100 tcp:7100        

The following example sets upwardly forwarding of host port 6100 to local:logd:

adb forward tcp:6100 local:logd        

Copy files to/from a device

Use the pull and push commands to re-create files to and from an device. Unlike the install control, which merely copies an APK file to a specific location, the pull and push commands let you lot 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 pull          remote          local        

To copy a file or directory and its sub-directories to the device, do the following:

adb push          local          remote        

Supersede local and remote with the paths to the target files/directory on your development car (local) and on the device (remote). For example:

adb push foo.txt /sdcard/foo.txt        

Stop the adb server

In some cases, yous might need to finish the adb server process and so restart it to resolve the trouble (eastward.k., if adb does not respond to a command).

To stop the adb server, use the adb impale-server command. Y'all tin can then restart the server by issuing any other adb command.

Issuing adb commands

You lot can issue adb commands from a control line on your development machine or from a script. The usage is:

adb [-d | -e | -south          serial_number]          command        

If in that location'south just one emulator running or only one device continued, the adb command is sent to that device by default. If multiple emulators are running and/or multiple devices are attached, you demand to use the -d, -e, or -s selection to specify the target device to which the control should be directed.

You tin can see a detailed list of all supported adb commands using the following control:

adb --help        

Event shell commands

You can use the shell command to upshot device commands through adb, or to beginning an interactive crush. To issue a single command use the shell command similar this:

adb [-d |-eastward | -southward          serial_number] crush          shell_command        

To start an interactive shell on a device use the vanquish command like this:

adb [-d | -eastward | -due south          serial_number] shell        

To exit an interactive beat out, press Command + D or type exit.

Note: With Android Platform-Tools 23 and higher, adb handles arguments the same way that the ssh(1) control does. This change has fixed a lot of bug with command injection and makes it possible to now safely execute commands that contain beat out metacharacters, such every bit adb install Let\'sGo.apk. But, this change means that the interpretation of whatsoever command that contains shell metacharacters has also inverse. For example, the adb shell setprop foo 'a b' command is now an error considering the single quotes (') are swallowed by the local trounce, and the device sees adb shell setprop foo a b. To make the command work, quote twice, once for the local shell and once for the remote crush, the same every bit you do with ssh(ane). For example, adb shell setprop foo "'a b'".

Android provides most of the usual Unix command-line tools. For a list of available tools, utilise the following control:

adb beat ls /arrangement/bin

Help is available for most of the commands via the --help argument. Many of the vanquish commands are provided past toybox. General help applicable to all toybox commands is available via toybox --assist.

Encounter besides Logcat Control-Line Tool which is useful for monitoring the organization log.

Telephone call activity managing director (am)

Within an adb beat out, y'all can issue commands with the activeness manager (am) tool to perform various system deportment, such equally start an activity, force-finish a process, broadcast an intent, modify the device screen properties, and more. While in a shell, the syntax is:

am          control        

You tin also issue an activity director command directly from adb without entering a remote shell. For example:

adb shell am starting time -a android.intent.action.VIEW        

Table 2. Bachelor activity manager commands

Control Clarification
outset [options] intent Start an Activity specified by intent .

See the Specification for intent arguments.

Options are:

  • -D: Enable debugging.
  • -W: Wait for launch to complete.
  • --offset-profiler file : Start profiler and send results to file .
  • -P file : Like --start-profiler, but profiling stops when the app goes idle.
  • -R count : Echo the action launch count times. Prior to each repeat, the top activity will be finished.
  • -South: Force stop the target app before starting the activity.
  • --opengl-trace: Enable tracing of OpenGL functions.
  • --user user_id | current: Specify which user to run as; if not specified, then run as the current user.
startservice [options] intent Start the Service specified by intent .

Encounter the Specification for intent arguments.

Options are:

  • --user user_id | current: Specify which user to run as; if not specified, then run equally the current user.
force-end parcel Forcefulness stop everything associated with packet (the app's package proper name).
kill [options] bundle Kill all processes associated with bundle (the app's package name). This command kills but processes that are rubber to impale and that will not touch on the user feel.

Options are:

  • --user user_id | all | current: Specify user whose processes to kill; all users if not specified.
kill-all Kill all background processes.
circulate [options] intent Consequence a circulate intent.

See the Specification for intent arguments.

Options are:

  • [--user user_id | all | current]: Specify which user to transport to; if not specified then send to all users.
instrument [options] component Start monitoring with an Instrumentation instance. Typically the target component is the form test_package/runner_class .

Options are:

  • -r: Print raw results (otherwise decode report_key_streamresult ). Employ with [-east perf true] to generate raw output for functioning measurements.
  • -e proper noun value : Set argument name to value . For exam runners a common form is -eastward testrunner_flag value[,value...].
  • -p file : Write profiling data to file .
  • -w: Wait for instrumentation to cease earlier returning. Required for exam runners.
  • --no-window-animation: Turn off window animations while running.
  • --user user_id | current: Specify which user instrumentation runs in; current user if non specified.
profile offset procedure file Start profiler on process , write results to file .
profile stop process End profiler on procedure .
dumpheap [options] process file Dump the heap of process , write to file .

Options are:

  • --user [user_id | current]: When supplying a procedure name, specify user of process to dump; uses current user if not specified.
  • -northward: Dump native heap instead of managed heap.
gear up-debug-app [options] packet Prepare app package to debug.

Options are:

  • -w: Wait for debugger when app starts.
  • --persistent: Retain this value.
clear-debug-app Clear the package previous fix for debugging with set-debug-app.
monitor [options] Outset monitoring for crashes or ANRs.

Options are:

  • --gdb: Starting time gdbserv on the given port at crash/ANR.
screen-compat {on | off} packet Control screen compatibility mode of package .
display-size [reset | width10elevation] Override device display size. This command is helpful for testing your app across dissimilar screen sizes past mimicking a modest screen resolution using a device with a large screen, and vice versa.

Case:
am display-size 1280x800

display-density dpi Override device display density. This command is helpful for testing your app across unlike screen densities on high-density screen surroundings using a depression density screen, and vice versa.

Example:
am display-density 480

to-uri intent Print the given intent specification equally a URI.

Meet the Specification for intent arguments.

to-intent-uri intent Print the given intent specification as an intent: URI.

See the Specification for intent arguments.

Specification for intent arguments

For activity director commands that have an intent statement, you tin specify the intent with the following options:

Call parcel manager (pm)

Within an adb shell, you can outcome commands with the bundle managing director (pm) tool to perform actions and queries on app packages installed on the device. While in a shell, the syntax is:

pm          command        

Y'all tin can also issue a package manager command straight from adb without entering a remote crush. For instance:

adb trounce pm uninstall          com.case.MyApp        

Table 3. Available bundle manager commands.

Command Description
list packages [options] filter Prints all packages, optionally only those whose parcel name contains the text in filter .

Options:

  • -f: Run into their associated file.
  • -d: Filter to only show disabled packages.
  • -e: Filter to only bear witness enabled packages.
  • -south: Filter to simply show arrangement packages.
  • -3: Filter to only prove third political party packages.
  • -i: Run into the installer for the packages.
  • -u: Likewise include uninstalled packages.
  • --user user_id : The user space to query.
listing permission-groups Prints all known permission groups.
listing permissions [options] group Prints all known permissions, optionally only those in group .

Options:

  • -thou: Organize by group.
  • -f: Impress all information.
  • -due south: Short summary.
  • -d: But list dangerous permissions.
  • -u: List only the permissions users will encounter.
list instrumentation [options] Listing all examination packages.

Options:

  • -f: Listing the APK file for the test packet.
  • target_package : List exam packages for only this app.
list features Prints all features of the organisation.
list libraries Prints all the libraries supported by the electric current device.
list users Prints all users on the arrangement.
path package Print the path to the APK of the given package .
install [options] path Installs a package (specified past path ) to the system.

Options:

  • -r: Reinstall an existing app, keeping its data.
  • -t: Allow test APKs to be installed. Gradle generates a test APK when you have merely run or debugged your app or have used the Android Studio Build > Build APK control. If the APK is congenital using a programmer preview SDK (if the targetSdkVersion is a letter instead of a number), you must include the -t selection with the install command if you are installing a exam APK.
  • -i installer_package_name : Specify the installer package name.
  • --install-location location : Sets the install location using one of the following values:
    • 0: Use the default install location
    • 1: Install on internal device storage
    • 2: Install on external media
  • -f: Install package on the internal organization memory.
  • -d: Allow version code downgrade.
  • -g: Grant all permissions listed in the app manifest.
  • --fastdeploy: Quickly update an installed package by just updating the parts of the APK that changed.
  • --incremental: Installs enough of the APK to launch the app while streaming the remaining data in the groundwork. To employ this feature, you must sign the APK, create an APK Signature Scheme v4 file, and place this file in the same directory as the APK. This feature is merely supported on certain devices. This choice forces adb to utilize the feature or neglect if it is not supported (with verbose data on why it failed). Suspend the --expect selection to look until the APK is fully installed before granting admission to the APK.

    --no-incremental prevents adb from using this characteristic.

uninstall [options] package Removes a package from the system.

Options:

  • -k: Continue the information and cache directories effectually after package removal.
clear bundle Deletes all data associated with a packet.
enable package_or_component Enable the given packet or component (written every bit "parcel/class").
disable package_or_component Disable the given bundle or component (written every bit "package/class").
disable-user [options] package_or_component

Options:

  • --user user_id : The user to disable.
grant package_name permission Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can exist any permission alleged in the app manifest. On devices running Android 5.ane (API level 22) and lower, must exist an optional permission divers by the app.
revoke package_name permission Revoke a permission from an app. On devices running Android 6.0 (API level 23) and higher, the permission tin can be any permission declared in the app manifest. On devices running Android v.1 (API level 22) and lower, must be an optional permission defined by the app.
set-install-location location Changes the default install location. Location values:
  • 0: Automobile: Let organization decide the best location.
  • 1: Internal: install on internal device storage.
  • 2: External: on external media.

Note: This is only intended for debugging; using this tin can cause apps to break and other undesireable beliefs.

go-install-location Returns the current install location. Return values:
  • 0 [motorcar]: Lets system decide the best location
  • one [internal]: Installs on internal device storage
  • 2 [external]: Installs on external media
set-permission-enforced permission [true | imitation] Specifies whether the given permission should be enforced.
trim-caches desired_free_space Trim cache files to attain the given free infinite.
create-user user_name Create a new user with the given user_name , press the new user identifier of the user.
remove-user user_id Remove the user with the given user_id , deleting all data associated with that user
get-max-users Prints the maximum number of users supported by the device.

Call device policy manager (dpm)

To assistance you develop and test your device direction (or other enterprise) apps, you can issue commands to the device policy manager (dpm) tool. Use the tool to control the active admin app or change a policy's condition data on the device. While in a beat, the syntax is:

dpm          command        

You can also issue a device policy director command directly from adb without entering a remote shell:

adb beat dpm          control        

Table four. Available device policy manager commands

Command Clarification
prepare-agile-admin [options] component Sets component as agile admin.

Options are:

  • --user user_id : Specify the target user. You lot can besides pass --user current to select the current user.
set-profile-possessor [options] component Sets component as agile admin and its bundle as profile owner for an existing user.

Options are:

  • --user user_id : Specify the target user. You can as well laissez passer --user current to select the current user.
  • --proper noun name : Specify the human-readable organization name.
prepare-device-possessor [options] component Sets component as active admin and its bundle as device owner.

Options are:

  • --user user_id : Specify the target user. You can also laissez passer --user current to select the electric current user.
  • --name name : Specify the human-readable arrangement name.
remove-agile-admin [options] component Disables an active admin. The app must declare android:testOnly in the manifest. This command also removes device and profile owners.

Options are:

  • --user user_id : Specify the target user. You tin can as well pass --user current to select the current user.
articulate-freeze-period-record Clears the device's tape of previously-set freeze periods for system OTA updates. This is useful to avoid the device's scheduling restrictions when developing apps that manage freeze-periods. Encounter Manage organisation updates.

Supported on devices running Android 9.0 (API level 28) and higher.

force-network-logs Forces the system to make any existing network logs prepare for retrieval by a DPC. If in that location are connection or DNS logs available, the DPC receives the onNetworkLogsAvailable() callback. See Network activity logging.

This command is rate-express. Supported on devices running Android 9.0 (API level 28) and higher.

strength-security-logs Forces the organization to make any existing security logs available to the DPC. If there are logs bachelor, the DPC receives the onSecurityLogsAvailable() callback. See Log enterprise device activeness.

This command is rate-limited. Supported on devices running Android nine.0 (API level 28) and college.

Accept a screenshot

The screencap command is a vanquish utility for taking a screenshot of a device display. While in a shell, the syntax is:

screencap          filename        

To use the screencap from the control line, type the following:

adb crush screencap /sdcard/screen.png        

Hither's an example screenshot session, using the adb shell to capture the screenshot and the pull command to download the file from the device:

$ adb vanquish shell@ $ screencap /sdcard/screen.png shell@ $ leave $ adb pull /sdcard/screen.png        

Record a video

The screenrecord 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-iv file. Yous can apply this file to create promotional or preparation videos or for debugging and testing.

In a beat out, utilise the following syntax:

screenrecord [options]          filename        

To utilise screenrecord from the command line, type the post-obit:

adb shell screenrecord /sdcard/demo.mp4        

End the screen recording by pressing Control + C (Control + C on Mac); otherwise, the recording stops automatically at 3 minutes or the time limit ready by --time-limit.

To begin recording your device screen, run the screenrecord command to record the video. Then, run the pull command to download the video from the device to the host calculator. Hither'southward an example recording session:

$ adb shell beat@ $ screenrecord --verbose /sdcard/demo.mp4 (press Control + C to cease) shell@ $ exit $ adb pull /sdcard/demo.mp4        

The screenrecord utility can tape at whatever supported resolution and bit rate y'all asking, while retaining the aspect ratio of the device display. The utility records at the native brandish resolution and orientation past default, with a maximum length of three minutes.

Limitations of the screenrecord utility:

  • Sound is not recorded with the video file.
  • Video recording is not available for devices running Clothing Os.
  • Some devices might not be able to record at their native brandish resolution. If you run across issues with screen recording, try using a lower screen resolution.
  • Rotation of the screen during recording is not supported. If the screen does rotate during recording, some of the screen is cut off in the recording.

Table five. screenrecord options

Options Description
--help Displays command syntax and options
--size widthxheight Sets the video size: 1280x720. The default value is the device's native display resolution (if supported), 1280x720 if not. For best results, use a size supported past your device's Advanced Video Coding (AVC) encoder.
--bit-charge per unit rate Sets the video bit charge per unit for the video, in megabits per second. The default value is 4Mbps. You can increment the fleck rate to improve video quality, but doing then results in larger movie files. The post-obit instance sets the recording bit charge per unit to 6Mbps:
screenrecord --bit-rate 6000000 /sdcard/demo.mp4
--time-limit fourth dimension Sets the maximum recording time, in seconds. The default and maximum value is 180 (iii minutes).
--rotate Rotates the output ninety degrees. This feature is experimental.
--verbose Displays log information on the command-line screen. If you do not ready this choice, the utility does not brandish any data while running.

Read ART profiles for apps

Starting in Android seven.0 (API level 24) the Android Runtime (Art) collects execution profiles for installed apps, which are used to optimize app performance. You might want to examine the collected profiles to understand which methods are adamant to be oftentimes executed and which classes are used during app startup.

To produce a text form of the profile information, use the command:

adb vanquish cmd package dump-profiles          parcel        

To retrieve the file produced, apply:

adb pull /information/misc/profman/package.txt        

Reset test devices

If yous examination your app across multiple test devices, it may exist useful to reset your device between tests, for example, to remove user data and reset the test environment. You tin can perform a factory reset of a examination device running Android ten (API level 29) or higher using the testharness adb beat out control, as shown below.

adb shell cmd testharness enable        

When restoring the device using testharness, the device automatically backs upward the RSA central that allows debugging through the current workstation in a persistent location. That is, after the device is reset, the workstation can proceed to debug and issue adb commands to the device without manually registering a new key.

Additionally, to help make it easier and more than secure to keep testing your app, using the testharness to restore a device also changes the post-obit device settings:

  • The device sets up certain system settings so that initial device setup wizards practice not appear. That is, the device enters a land from which yous tin can speedily install, debug, and examination your app.
  • Settings:
    • Disables lock screen
    • Disables emergency alerts
    • Disables auto-sync for accounts
    • Disables automatic organisation updates
  • Other:
    • Disables preinstalled security apps

If yous app needs to find and adjust to the default settings of the testharness command, you can use the ActivityManager.isRunningInUserTestHarness().

sqlite

sqlite3 starts the sqlite command-line programme for examining sqlite databases. It includes commands such as .dump to print the contents of a table, and .schema to print the SQL CREATE statement for an existing table. You tin can likewise execute SQLite commands from the command line, every bit shown below.

$ adb -south emulator-5554 beat out $ sqlite3 /information/information/com.case.app/databases/rssitems.db SQLite version three.3.12 Enter ".help" for instructions        

For more information, come across the sqlite3 command line documentation.

scottbuthadou1985.blogspot.com

Source: https://developer.android.com/studio/command-line/adb

0 Response to "To Be Mad Ship One Menaul Is It You Know Have Listen to It"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel