Install OEM USB drivers  |  Android Developers
Driver on

Android Debug Bridge (adb)  |  Android Developers

Android Debug Bridge (adb) is a flexible command-line software that permits you to talk with a
machine. The adb command facilitates quite a lot of machine actions, similar to putting in and debugging
apps, and it supplies entry to a Unix shell that you need to use to run quite a lot of instructions on a
machine. It’s a client-server program that features three parts:

  • A consumer, which sends instructions. The consumer runs in your growth machine. You may
    invoke a consumer from a command-line terminal by issuing an adb command.
  • A daemon (adbd), which runs instructions on a tool. The daemon runs as a background
    course of on every machine.
  • A server, which manages communication between the consumer and the daemon. The server
    runs as a background course of in your growth machine.

adb is included within the Android SDK Platform-Instruments package deal. You may obtain this
package deal with the SDK Supervisor, which installs
it at android_sdk/platform-tools/. Or if you’d like the standalone Android SDK
Platform-Instruments package deal, you possibly can obtain it right here.

For data on connecting a tool to be used over ADB, together with use the Connection
Assistant to troubleshoot frequent issues, see
Run apps on a {hardware} machine.

How adb works

While you begin an adb consumer, the consumer first checks whether or not there’s an adb server
course of already operating. If there is not, it begins the server course of. When the server begins,
it binds to native TCP port 5037 and listens for instructions despatched from adb shoppers—all adb
shoppers use port 5037 to speak with the adb server.

The server then units up connections to all operating units.
It locates emulators by scanning odd-numbered ports within the vary
5555 to 5585, the vary utilized by the primary 16 emulators. The place the server finds an adb
daemon (adbd), it units up a connection to that port. Notice that every emulator
makes use of a pair of sequential ports — an even-numbered port for
console connections and an odd-numbered port for adb connections. For instance:

Emulator 1, console: 5554
Emulator 1, adb: 5555
Emulator 2, console: 5556
Emulator 2, adb: 5557
and so forth…

As proven, the emulator linked to adb on port 5555 is identical because the emulator
whose console listens on port 5554.

As soon as the server has arrange connections to all units, you need to use adb instructions to
entry these units. As a result of the server manages connections to units and handles
instructions from a number of adb shoppers, you possibly can management any machine from any consumer (or
from a script).

Allow adb debugging in your machine

To make use of adb with a tool linked over USB, you could allow
USB debugging within the machine system settings, below
Developer choices
.

On Android 4.2 and better, the Developer choices display is
hidden by default. To make it seen, go to
Settings > About cellphone and faucet Construct quantity seven instances. Return to the earlier
display to seek out Developer choices on the backside.

On some units, the Developer choices display could be situated or named in a different way.

Now you can join your machine with USB. You may confirm that your machine is
linked by executing adb units from the
android_sdk/platform-tools/ listing. If linked,
you may see the machine title listed as a “machine.”

Notice: While you join a tool operating Android 4.2.2 or increased,
the system reveals a dialog asking whether or not to just accept an RSA key that permits
debugging by way of this pc. This safety mechanism protects person units as a result of it ensures
that USB debugging and different adb instructions can’t be executed until you are capable of unlock the
machine and acknowledge the dialog.

For extra details about connecting to a tool over USB, learn
Run Apps on a {Hardware} System.

Connect with a tool over Wi-Fi (Android 11+)

Android 11 and better assist deploying and debugging your app wirelessly
out of your workstation utilizing Android Debug Bridge (adb). For instance, you possibly can
deploy your debuggable app to a number of distant units with out bodily
connecting your machine by way of USB. This eliminates the necessity to cope with frequent USB
connection points, similar to driver set up.

To make use of wi-fi debugging, it’s essential pair your machine to your workstation
utilizing a pairing code. Your workstation and machine have to be linked to the identical
wi-fi community. To hook up with your machine, comply with these steps:

wireless adb pairing dialog

Determine 1. Wi-fi ADB pairing dialog.

  1. In your workstation, replace to the most recent model of the
    SDK Platform-Instruments.
  2. On the machine, allow developer choices.
  3. Allow the Wi-fi debugging choice.
  4. On the dialog that asks Enable wi-fi debugging on this community?, click on
    Enable.
  5. Choose Pair machine with pairing code. Pay attention to the pairing code, IP
    tackle, and port quantity displayed on the machine (see picture).
  6. In your workstation, open a terminal and navigate to
    android_sdk/platform-tools.
  7. Run adb pair
    ipaddr:port
    .
    Use the IP tackle and port quantity from step 5.
  8. When prompted, enter the pairing code that you just acquired in step 5. A message
    signifies that your machine has been efficiently paired.

        none
        Enter pairing code: 482924
        Efficiently paired to 192.168.1.130:37099 [guid=adb-235XY]
        
  9. (For Linux or Microsoft Home windows solely) Run adb join
    ipaddr:port
    . Use the IP tackle and port below
    Wi-fi debugging.

    wireless adb IP and port number

    Determine 2. Wi-fi adb IP and port quantity.

Connect with a tool over Wi-Fi (Android 10 and decrease)

adb normally communicates with the machine over USB, however you too can use adb over Wi-Fi after
some preliminary setup over USB, as described under. Should you’re growing for Put on OS, nevertheless,
you must as an alternative see the information to
debugging a Put on OS app,
which has particular directions for utilizing adb with Wi-Fi and Bluetooth.

  1. Join your Android machine and adb host pc
    to a typical Wi-Fi community accessible to each.
    Beware that not all entry factors
    are appropriate; you would possibly want to make use of an entry level
    whose firewall is configured correctly to assist adb.
  2. If you’re connecting
    to a Put on OS machine, flip off Bluetooth on the cellphone that is paired with the machine.
  3. Join the machine to the host pc with a USB cable.
  4. Set the goal machine to pay attention for a TCP/IP connection on port 5555.

    adb tcpip 5555
    
  5. Disconnect the USB cable from the goal machine.
  6. Discover the IP tackle of the Android machine. For instance, on a Nexus machine, you will discover
    the IP tackle at Settings > About pill
    (or About cellphone) > Standing > IP tackle. Or,
    on a Put on OS machine, you will discover the IP tackle at Settings >
    Wi-Fi Settings > Superior > IP tackle.
  7. Connect with the machine by its IP tackle.

    adb join device_ip_address
    
  8. Affirm that your host pc is linked to the goal machine:

    $ adb units
    Checklist of units connected
    device_ip_address:5555 machine
    

You are now good to go!

If the adb connection is ever misplaced:

  1. Be sure that your host continues to be linked to the identical Wi-Fi community your Android machine is.
  2. Reconnect by executing the adb join step once more.
  3. Or if that does not work, reset your adb host:

    adb kill-server
    

    Then begin over from the start.

Question for units

Earlier than issuing adb instructions, it’s useful to know what machine situations are linked
to the adb server. You may generate an inventory of connected units utilizing the
units command.

  adb units -l
  

In response, adb prints this standing data for every machine:

  • Serial quantity: A string created by adb to uniquely determine the machine
    by its port quantity.
    This is an instance serial quantity: emulator-5554
  • State: The connection state of the machine will be one of many following:
    • offline: The machine isn’t linked to adb or isn’t
      responding.
    • machine: The machine is now linked to the adb server. Notice that
      this state doesn’t suggest that the Android system is totally booted and operational as a result of
      the machine connects to adb
      whereas the system continues to be booting. Nonetheless, after boot-up, that is the traditional operational
      state of an machine.
    • no machine: There isn’t any machine linked.
  • Description: Should you embrace the -l choice, the units
    command tells you what the machine is. This data is useful when you may have a number of units
    linked so that you could inform them aside.

The next instance reveals the units command and its output. There are three
units operating. The primary two traces within the checklist are emulators, and the third line is a {hardware}
machine that’s connected to the pc.

$ adb units
Checklist of units connected
emulator-5556 machine product:sdk_google_phone_x86_64 mannequin:Android_SDK_built_for_x86_64 machine:generic_x86_64
emulator-5554 machine product:sdk_google_phone_x86 mannequin:Android_SDK_built_for_x86 machine:generic_x86
0a388e93      machine usb:1-1 product:razor mannequin:Nexus_7 machine:flo

Emulator not listed

The adb units command has a corner-case command sequence that causes operating
emulator(s) to not present up within the adb units output regardless that
the emulator(s) are seen in your desktop. This occurs when all of the next
circumstances are true:

  1. The adb server isn’t operating, and
  2. You employ the emulator command with the -port or
    -ports choice with an odd-numbered port worth between 5554 and 5584, and
  3. The odd-numbered port you selected isn’t busy so the port connection will be made on the
    specified port quantity, or whether it is busy, the emulator switches to
    one other port that meets the necessities in 2, and
  4. You begin the adb server after you begin the emulator.

One approach to keep away from this example is to let the emulator select its personal ports, and do not run extra
than 16 emulators without delay. One other means is to at all times begin the adb server earlier than you utilize the
emulator command, as defined within the following examples.

Instance 1: Within the following command sequence, the adb units command begins
the adb server, however the checklist of units doesn’t seem.

Cease the adb server and enter the next instructions within the order proven. For the avd title, present
a sound avd title out of your system. To get an inventory of avd names, sort emulator -list-avds.
The emulator command is within the android_sdk/instruments listing.

$ adb kill-server
$ emulator -avd Nexus_6_API_25 -port 5555
$ adb units

Checklist of units connected
* daemon not operating. beginning it now on port 5037 *
* daemon began efficiently *

Instance 2: Within the following command sequence, adb units shows the
checklist of units as a result of the adb server was began first.

To see the emulator within the adb units output, cease the adb server, after which begin
it once more after utilizing the emulator command and earlier than utilizing the
adb units command, as follows:

$ adb kill-server
$ emulator -avd Nexus_6_API_25 -port 5557
$ adb start-server
$ adb units

Checklist of units connected
emulator-5557 machine

For extra details about emulator command-line choices,
see Utilizing Command Line
Parameters.

Ship instructions to a selected machine

If a number of units are operating, you could specify the goal machine
if you difficulty the adb command. To specify the goal, use the units command
to get the serial variety of the goal. After getting the serial quantity, use the
-s choice with the adb instructions to specify the serial quantity.
If you are going to difficulty loads of adb instructions, you possibly can set the
$ANDROID_SERIAL surroundings variable to include the serial quantity
as an alternative. Should you use each
-s and $ANDROID_SERIAL, -s overrides
$ANDROID_SERIAL.

Within the following instance, the checklist of connected units is obtained, after which the serial
variety of one of many units is used to put in the helloWorld.apk on that machine.

$ adb units
Checklist of units connected
emulator-5554 machine
emulator-5555 machine

$ adb -s emulator-5555 set up helloWorld.apk

Notice: Should you difficulty a command with out specifying a goal machine
when a number of units can be found, adb generates an error.

When you have a number of units out there, however just one is an emulator,
use the -e choice to ship instructions to the emulator. Likewise, if there are a number of
units however just one {hardware} machine connected, use the -d choice to ship instructions to
the {hardware} machine.

Set up an app

You need to use adb to put in an APK on an emulator or linked machine
with the set up command:

adb set up path_to_apk

You have to use the -t choice with the set up
command if you set up a check APK. For extra data,
see -t.

For extra details about create an APK file that you would be able to set up on an emulator/machine
occasion, see Construct and Run Your App.

Notice that, in case you are utilizing Android Studio, you don’t want to make use of adb straight to put in
your app on the emulator/machine. As an alternative, Android Studio handles the packaging and set up
of the app for you.

Arrange port forwarding

You need to use the ahead command to arrange arbitrary port forwarding, which
forwards requests on a selected host port to a special port on a tool.
The next instance units up forwarding of host port 6100 to machine port 7100:

adb ahead tcp:6100 tcp:7100

The next instance units up forwarding of host port 6100 to native:logd:

adb ahead tcp:6100 native:logd

Copy recordsdata to/from a tool

Use the pull and push instructions to repeat recordsdata to
and from an machine. In contrast to the set up command,
which solely copies an APK file to a selected location, the pull and push
instructions allow you to copy arbitrary directories and recordsdata to any location in a tool.

To repeat a file or listing and its sub-directories from the machine,
do the next:

adb pull distant native

To repeat a file or listing and its sub-directories to the machine,
do the next:

adb push native distant

Change native and distant with the paths to
the goal recordsdata/listing in your growth machine (native) and on the
machine (distant). For instance:

adb push foo.txt /sdcard/foo.txt

Cease the adb server

In some circumstances, you would possibly have to terminate the adb server course of after which restart it
to resolve the issue (e.g., if adb doesn’t reply to a command).

To cease the adb server, use the adb kill-server command.
You may then restart the server by issuing another adb command.

Issuing adb instructions

You may difficulty adb instructions from a command line in your growth machine or from a script.
The utilization is:

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

If there’s just one emulator operating or just one machine linked, the adb command is
despatched to that machine by default. If a number of emulators are operating and/or a number of units are
connected, it’s essential use the -d, -e, or -s
choice to specify the goal machine to which the command ought to be directed.

You may see an in depth checklist of all supported adb instructions utilizing the next command:

adb --help

Situation shell instructions

You need to use the shell command to difficulty machine instructions by way of adb, or to begin an
interactive shell.
To difficulty a single command use the shell command like this:

adb [-d |-e | -s serial_number] shell shell_command

To start out an interactive shell on a tool use the shell command like this:

adb [-d | -e | -s serial_number] shell

To exit an interactive shell, press Management + D or sort exit.

Notice:
With Android Platform-Instruments 23 and better, adb handles arguments the identical means that the
ssh(1) command does.
This variation has fastened loads of issues with
command injection
and makes it
potential to now safely execute instructions that include shell
metacharacters, similar to
adb set up Let'sGo.apk. However, this variation signifies that the interpretation
of any command that incorporates shell metacharacters has additionally modified.
For instance, the adb shell setprop foo 'a b' command is now an error as a result of the
single quotes (') are swallowed by the native shell, and the machine sees
adb shell setprop foo a b. To make the command work, quote twice,
as soon as for the native shell and as soon as for the distant shell, the identical as you do with
ssh(1). For instance, adb shell setprop foo "'a b'".

Android supplies a lot of the typical Unix command-line instruments. For an inventory of obtainable instruments, use
the next command:

adb shell ls /system/bin

Assist is obtainable for a lot of the instructions by way of the --help argument.
Lots of the shell instructions are supplied by
toybox.
Normal assist relevant to all toybox instructions is obtainable by way of toybox --help.

See additionally Logcat Command-Line Device which is helpful
for monitoring the system log.

Name exercise supervisor (am)

Inside an adb shell, you possibly can difficulty instructions with the exercise supervisor (am) software to
carry out numerous system actions, similar to begin an exercise, force-stop a course of,
broadcast an intent, modify the machine display properties, and extra. Whereas in a shell,
the syntax is:

am command

You can even difficulty an exercise supervisor command straight from adb
with out getting into a distant shell. For instance:

adb shell am begin -a android.intent.motion.VIEW

Desk 2. Obtainable exercise supervisor instructions

Command Description
begin [options] intent Begin an Exercise specified by
intent.

See the
Specification for intent arguments.

Choices are:

  • -D: Allow debugging.
  • -W: Await launch to finish.
  • --start-profiler file: Begin profiler and ship outcomes to
    file.
  • -P file: Like --start-profiler,
    however profiling stops when the app goes idle.
  • -R depend: Repeat the exercise launch depend
    instances. Prior to every repeat,
    the highest exercise shall be completed.
  • -S: Power cease the goal app earlier than beginning the exercise.
  • --opengl-trace: Allow tracing of OpenGL capabilities.
  • --user user_id | present: Specify which person to run as; if not
    specified, then run as the present person.

startservice [options] intent
Begin the Service specified by
intent.

See the
Specification for intent arguments.

Choices are:

  • --user user_id | present: Specify which person to run as; if not
    specified, then run as the present person.

force-stop package deal
Power cease the whole lot related to package deal (the app’s package deal title).

kill [options] package deal
Kill all processes related to package deal
(the app’s package deal title). This command kills solely
processes which are protected to kill and that won’t impression the person
expertise.

Choices are:

  • --user user_id | all | present: Specify person whose processes to kill;
    all customers if not specified.

kill-all
Kill all background processes.

broadcast [options] intent
Situation a broadcast intent.

See the
Specification for intent arguments.

Choices are:

  • [--user user_id | all | current]: Specify which person to ship to; if not
    specified then ship to all customers.

instrument [options] element
Begin monitoring with an
Instrumentation occasion.
Usually the goal element
is the shape test_package/runner_class.

Choices are:

  • -r: Print uncooked outcomes (in any other case decode
    report_key_streamresult). Use with
    [-e perf true] to generate uncooked output for efficiency measurements.

  • -e title worth: Set argument title
    to worth.
    For check runners a typical kind is
    -e testrunner_flag worth[,value...]
    .

  • -p file: Write profiling knowledge to file.
  • -w: Await instrumentation to complete earlier than returning. Required for
    check runners.

  • --no-window-animation: Flip off window animations whereas operating.
  • --user user_id | present: Specify which person instrumentation runs in;
    present person if not specified.

profile begin course of file
Begin profiler on course of, write outcomes to file.

profile cease course of
Cease profiler on course of.

dumpheap [options] course of file
Dump the heap of course of, write to file.

Choices are:

  • --user [user_id | current]: When supplying a course of title,
    specify person of course of to dump; makes use of present person if not specified.
  • -n: Dump native heap as an alternative of managed heap.

set-debug-app [options] package deal
Set app package deal to debug.

Choices are:

  • -w: Await debugger when app begins.
  • --persistent: Retain this worth.

clear-debug-app
Clear the package deal earlier set for debugging with set-debug-app.

monitor [options]
Begin monitoring for crashes or ANRs.

Choices are:

  • --gdb: Begin gdbserv on the given port at crash/ANR.

screen-compat off package deal
Management display
compatibility mode of package deal.

display-size [reset | widthxheight]
Override machine show dimension.
This command is useful for testing your app throughout completely different display sizes by mimicking a small
display decision utilizing a tool with a big display, and vice versa.

Instance:
am display-size 1280x800


display-density dpi
Override machine show density.
This command is useful for testing your app throughout completely different display densities on high-density
display surroundings utilizing a low density display, and vice versa.

Instance:
am display-density 480


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

See 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 exercise supervisor instructions that take an intent argument, you possibly can
specify the intent with the next choices:

Name package deal supervisor (pm)

Inside an adb shell, you possibly can difficulty instructions with the package deal supervisor (pm) software to
carry out actions and queries on app packages put in on the machine. Whereas in a shell,
the syntax is:

pm command

You can even difficulty a package deal supervisor command straight from adb
with out getting into a distant shell. For instance:

adb shell pm uninstall com.instance.MyApp

Desk 3. Obtainable package deal supervisor instructions.

Command Description

checklist packages [options] filter
Prints all packages, optionally solely
these whose package deal title incorporates the textual content in filter.

Choices:

  • -f: See their related file.
  • -d: Filter to solely present disabled packages.
  • -e: Filter to solely present enabled packages.
  • -s: Filter to solely present system packages.
  • -3: Filter to solely present third celebration packages.
  • -i: See the installer for the packages.
  • -u: Additionally embrace uninstalled packages.
  • --user user_id: The person area to question.

checklist permission-groups
Prints all identified permission teams.

checklist permissions [options] group
Prints all identified permissions, optionally solely
these in group.

Choices:

  • -g: Manage by group.
  • -f: Print all data.
  • -s: Brief abstract.
  • -d: Solely checklist harmful permissions.
  • -u: Checklist solely the permissions customers will see.

checklist instrumentation [options]
Checklist all check packages.

Choices:

  • -f: Checklist the APK file for the check package deal.
  • target_package: Checklist check packages for under this app.

checklist options
Prints all options of the system.

checklist libraries
Prints all of the libraries supported by the present machine.

checklist customers
Prints all customers on the system.

path package deal
Print the trail to the APK of the given package deal.

set up [options] path
Installs a package deal (specified by path) to the system.

Choices:


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

Choices:

  • -k: Maintain the info and cache directories round after package deal elimination.

clear package deal
Deletes all knowledge related to a package deal.

allow package_or_component
Allow the given package deal or element (written as “package deal/class”).

disable package_or_component
Disable the given package deal or element (written as “package deal/class”).

disable-user [options] package_or_component

Choices:

  • --user user_id: The person to disable.

grant package_name permission
Grant a permission to an app. On units operating Android 6.0 (API degree 23)
and better, the permission will be any permission declared within the app manifest. On units
operating Android 5.1 (API degree 22) and decrease, have to be an optionally available permission outlined by the
app.

revoke package_name permission
Revoke a permission from an app. On units operating Android 6.0 (API degree
23) and better, the permission will be any permission declared within the app manifest. On units
operating Android 5.1 (API degree 22) and decrease, have to be an optionally available permission outlined by the
app.

set-install-location location
Adjustments the default set up location. Location values:

  • 0: Auto: Let system determine the perfect location.
  • 1: Inside: set up on inner machine storage.
  • 2: Exterior: on exterior media.

Notice: That is solely supposed for debugging; utilizing this may trigger
apps to interrupt and different undesireable conduct.


get-install-location
Returns the present set up location. Return values:

  • 0 [auto]: Lets system determine the perfect location
  • 1 [internal]: Installs on inner machine storage
  • 2 [external]: Installs on exterior media

set-permission-enforced permission [true | false]
Specifies whether or not the given permission ought to be enforced.

trim-caches desired_free_space
Trim cache recordsdata to achieve the given free area.

create-user user_name
Create a brand new person with the given user_name,
printing the brand new person identifier of the person.

remove-user user_id
Take away the person with the given user_id,
deleting all knowledge related to that person

get-max-users
Prints the utmost variety of customers supported by the machine.

Name machine coverage supervisor (dpm)

That will help you develop and check your machine administration (or different enterprise) apps, you possibly can difficulty
instructions to the machine coverage supervisor (dpm) software. Use the software to manage the lively
admin app or change a coverage’s standing knowledge on the machine.
Whereas in a shell, the syntax is:

dpm command

You can even difficulty a tool coverage supervisor command straight from adb
with out getting into a distant shell:

adb shell dpm command

Desk 4. Obtainable machine coverage supervisor instructions

Command Description
set-active-admin [options] element Units element as lively admin.

Choices are:

  • --user user_id: Specify the goal person. You can even go
    --user present to pick out the present person.
set-profile-owner [options] element Units element as lively admin and its package deal as profile proprietor for an current person.

Choices are:

  • --user user_id: Specify the goal person. You may
    additionally go --user present to pick out the present person.
  • --name title: Specify the human-readable group title.
set-device-owner [options] element Units element as lively admin and its package deal as machine proprietor.

Choices are:

  • --user user_id: Specify the goal person. You can even go
    --user present to pick out the present person.
  • --name title: Specify the human-readable group title.
remove-active-admin [options] element Disables an lively admin. The app should declare
android:testOnly
within the manifest. This command additionally removes machine and profile homeowners.

Choices are:

  • --user user_id: Specify the goal person. You can even go
    --user present to pick out the present person.
clear-freeze-period-record Clears the machine’s document of previously-set freeze durations for system OTA updates. That is helpful
to keep away from the machine’s scheduling restrictions when growing apps that handle freeze-periods. See
Handle system updates.

Supported on units operating Android 9.0 (API degree 28) and better.

force-network-logs Forces the system to make any current community logs prepared for retrieval by a DPC. If there are
connection or DNS logs out there, the DPC receives the
onNetworkLogsAvailable()
callback. See Community exercise logging.

This command is rate-limited. Supported on units operating Android 9.0 (API degree 28) and better.

force-security-logs Forces the system to make any current safety logs out there to the DPC. If there are logs
out there, the DPC receives the
onSecurityLogsAvailable()
callback. See Log enterprise machine
exercise.

This command is rate-limited. Supported on units operating Android 9.0 (API degree 28) and better.

Take a screenshot

The screencap command is a shell utility for taking a screenshot of a tool show.
Whereas in a shell, the syntax is:

screencap filename

To make use of the screencap from the command line, sort the next:

adb shell screencap /sdcard/display.png

This is an instance screenshot session, utilizing the adb shell to seize the screenshot and the
pull command to obtain the file from the machine:

$ adb shell
[email protected] $ screencap /sdcard/display.png
[email protected] $ exit
$ adb pull /sdcard/display.png

Report a video

The screenrecord command is a shell utility for recording the show of units
operating Android 4.4 (API degree 19) and better. The utility data display exercise to an MPEG-4
file. You need to use this file to create promotional or coaching movies or for debugging and testing.

In a shell, use the next syntax:

screenrecord [options] filename

To make use of screenrecord from the command line, sort the next:

adb shell screenrecord /sdcard/demo.mp4

Cease the display recording by urgent Management + C (Command + C on Mac); in any other case, the recording
stops mechanically at three minutes or the time restrict set by --time-limit.

To start recording your machine display, run the screenrecord command to document
the video. Then, run the pull command to obtain the video from the machine to the host
pc. This is an instance recording session:

$ adb shell
[email protected] $ screenrecord --verbose /sdcard/demo.mp4
(press Management + C to cease)
[email protected] $ exit
$ adb pull /sdcard/demo.mp4

The screenrecord utility can document at any supported decision and bit fee you
request, whereas retaining the facet ratio of the machine show. The utility data on the native
show decision and orientation by default, with a most size of three minutes.

Limitations of the screenrecord utility:

  • Audio isn’t recorded with the video file.
  • Video recording isn’t out there for units operating Put on OS.
  • Some units won’t be capable to document at their native show decision.
    Should you encounter issues with display recording, strive utilizing a decrease display decision.
  • Rotation of the display throughout recording isn’t supported. If the display does rotate throughout
    recording, a few of the display is reduce off within the recording.

Desk 5. screenrecord choices

Choices Description
--help Shows command syntax and choices
--size widthxtop Units the video dimension: 1280x720. The default worth is the machine’s native
show decision (if supported), 1280×720 if not. For finest outcomes, use a dimension supported
by your machine’s Superior Video Coding (AVC) encoder.
--bit-rate fee Units the video bit fee for the video, in megabits per second. The default worth is 4Mbps.
You may enhance the bit fee to enhance video high quality, however doing so leads to bigger film
recordsdata. The next instance units the recording bit fee to 6Mbps:

screenrecord --bit-rate 6000000 /sdcard/demo.mp4
--time-limit time Units the utmost recording time, in seconds. The default and most worth is 180
(Three minutes).
--rotate Rotates the output 90 levels. This characteristic is experimental.
--verbose Shows log data on the command-line display. If you don’t set this feature,
the utility doesn’t show any data whereas operating.

Learn ART profiles for apps

Beginning in Android 7.0 (API degree 24) the Android Runtime (ART) collects execution profiles for
put in apps, that are used to optimize app efficiency. You may want
to look at the collected profiles to know which strategies are decided to be ceaselessly
executed and which lessons are used throughout app startup.

To supply a textual content type of the profile data, use the command:

adb shell cmd package deal dump-profiles package deal

To retrieve the file produced, use:

adb pull /knowledge/misc/profman/package deal.txt

Reset check units

Should you check your app throughout a number of check units, it could be helpful to reset your machine between
exams, for instance, to take away person knowledge and reset the check surroundings. You may carry out a manufacturing unit
reset of a check machine operating Android 10 (API degree 29) or increased utilizing the
testharness adb shell command, as proven under.

adb shell cmd testharness allow

When restoring the machine utilizing testharness, the machine mechanically backs up the RSA
key that permits debugging by way of the present workstation in a persistent location. That’s, after
the machine is reset, the workstation can proceed to debug and difficulty adb instructions to the machine
with out manually registering a brand new key.

Moreover, to assist make it simpler and safer to maintain testing your app, utilizing the
testharness to revive a tool additionally adjustments the next machine settings:

  • The machine units up sure system settings in order that preliminary machine setup wizards don’t seem. That’s, the machine enters a state from which you’ll be able to rapidly set up, debug, and check your app.
  • Settings:
    • Disables lock display
    • Disables emergency alerts
    • Disables auto-sync for accounts
    • Disables computerized system updates
  • Different:
    • Disables preinstalled safety apps

Should you app must detect and adapt to the default settings of the testharness
command, you need to use the

ActivityManager.isRunningInUserTestHarness().

sqlite

sqlite3 begins the sqlite command-line program for analyzing sqlite databases.
It contains instructions similar to .dump to print the contents of a desk, and
.schema to print the SQL CREATE assertion for an current desk.
You can even execute SQLite instructions from the command line, as proven under.

$ adb -s emulator-5554 shell
$ sqlite3 /knowledge/knowledge/com.instance.app/databases/rssitems.db
SQLite model 3.3.12
Enter ".assist" for directions

For extra data, see the sqlite3 command line documentation.

Leave a Reply

Your email address will not be published. Required fields are marked *