Home | History | Annotate | Download | only in help

Lines Matching full:adb

4 page.tags="adb"
29 <li><a href="#stopping">Stopping the adb server</a></li>
35 <p>Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an
41 by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create
42 adb clients. </li>
44 manages communication between the client and the adb daemon running on an emulator or device. </li>
48 <p>You can find the {@code adb} tool in {@code &lt;sdk&gt;/platform-tools/}.</p>
50 <p>When you start an adb client, the client first checks whether there is an adb server
52 it binds to local TCP port 5037 and listens for commands sent from adb clients&mdash;all adb
53 clients use port 5037 to communicate with the adb server. </p>
55 <p>The server then sets up connections to all running emulator/device instances. It locates emulator/device instances by scanning odd-numbered ports in the range 5555 to 5585, the range used by emulators/devices. Where the server finds an adb daemon, it sets up a connection to that port. Note that each emulator/device instance acquires a pair of sequential ports &mdash; an even-numbered port for console connections and an odd-numbered port for adb connections. For example: </p>
59 Emulator 1, adb: 5555<br>
61 Emulator 2, adb: 5557<br>
65 <p>As shown, the emulator instance connected to adb on port 5555 is the same as the instance
68 <p>Once the server has set up connections to all emulator instances, you can use adb commands to
70 instances and handles commands from multiple adb clients, you can control any emulator/device
77 that USB debugging and other adb commands cannot be executed unless you're able to unlock the
78 device and acknowledge the dialog. This requires that you have adb version 1.0.31 (available with
85 <p>You can issue adb commands from a command line on your development machine or from a script.
89 adb [-d|-e|-s &lt;serialNumber&gt;] &lt;command&gt;
92 <p>If there's only one emulator running or only one device connected, the adb command is
101 <p>The table below lists all of the supported adb commands and explains their meaning and usage. </p>
103 <p class="table-caption"><strong>Table 1.</strong> Available adb commands</p>
115 <td>Direct an adb command to the only attached USB device.</td>
121 <td>Direct an adb command to the only running emulator instance.</td>
127 <td>Direct an adb command a specific emulator/device instance, referred to by its adb-assigned serial number (such as "emulator-5556").</td>
141 <td>Prints a list of supported adb commands.</td>
147 <td>Prints the adb version number. </td>
168 <code>adb forward tcp:8000 jdwp:472</code><br>
218 <td>Prints the adb instance serial number string.</td>
224 <td>Prints the adb state of an emulator/device instance.</td>
231 <td>You can prepend this command to other adb commands, in which case adb will wait until the emulator/device instance is connected before issuing the other commands. Here's an example:
232 <pre class="no-pretty-print">adb wait-for-device shell getprop</pre>
234 Note that this command does <em>not</em> cause adb to wait until the entire system is fully booted. For that reason, you should not prepend it to other commands that require a fully booted system. As an example, the <code>install</code> requires the Android package manager, which is available only after the system is fully booted. A command such as
236 <pre class="no-pretty-print">adb wait-for-device install &lt;app&gt;.apk</pre>
238 would issue the <code>install</code> command as soon as the emulator or device instance connected to the adb server, but before the Android system was fully booted, so it would result in an error. </td>
246 <td>Checks whether the adb server process is running and starts it, if not.</td>
252 <td>Terminates the adb server process.</td>
283 <p>Before issuing adb commands, it is helpful to know what emulator/device instances are connected to the adb server. You can generate a list of attached emulators/devices using the <code>devices</code> command: </p>
285 <pre class="no-pretty-print">adb devices</pre>
287 <p>In response, adb prints this status information for each instance:</p>
290 <li>Serial number &mdash; A string created by adb to uniquely identify an emulator/device instance by its
295 <li><code>offline</code> &mdash; the instance is not connected to adb or is not responding.</li>
296 <li><code>device</code> &mdash; the instance is now connected to the adb server. Note that this state does not
297 imply that the Android system is fully booted and operational, since the instance connects to adb
311 <pre class="no-pretty-print">adb devices
325 when issuing adb commands. To do so, use the <code>-s</code> option in the commands. The usage
328 <pre class="no-pretty-print">adb -s &lt;serialNumber&gt; &lt;command&gt; </pre>
330 <p>As shown, you specify the target instance for a command using its adb-assigned serial number.
334 <pre class="no-pretty-print">adb -s emulator-5556 install helloWorld.apk</pre>
337 while multiple devices are available, adb generates an error.
348 <p>You can use adb to copy an application from your development computer and install it on an emulator/device instance. To do so, use the <code>install</code> command. With the command, you must specify the path to the .apk file that you want to install:</p>
350 <pre class="no-pretty-print">adb install &lt;path_to_apk&gt;</pre>
355 <p>Note that, if you are using the Eclipse IDE and have the ADT plugin installed, you do not need to use adb (or aapt) directly to install your application on the emulator/device. Instead, the ADT plugin handles the packaging and installation of the application for you. </p>
365 <pre class="no-pretty-print">adb forward tcp:6100 tcp:7100</pre>
366 <p>You can also use adb to set up forwarding to named abstract UNIX domain sockets, as illustrated here:</p>
367 <pre class="no-pretty-print">adb forward tcp:6100 local:logd </pre>
375 <p>You can use the adb commands <code>pull</code> and <code>push</code> to copy files to
382 <pre class="no-pretty-print">adb pull &lt;remote&gt; &lt;local&gt;</pre>
385 <pre class="no-pretty-print">adb push &lt;local&gt; &lt;remote&gt;</pre>
390 <pre class="no-pretty-print">adb push foo.txt /sdcard/foo.txt</pre>
402 <p>Adb provides a Unix shell that you can use to run a variety of commands on an emulator
410 the adb remote shell on the emulator/device. To issue a single command without entering a
413 <pre class="no-pretty-print">adb [-d|-e|-s &lt;serialNumber&gt;] shell &lt;shell_command&gt;</pre>
417 <pre class="no-pretty-print">adb [-d|-e|-s &lt;serialNumber&gt;] shell</pre>
428 <p>Within an adb shell, you can issue commands with the activity manager ({@code am}) tool to
436 <p>You can also issue an activity manager command directly from adb
439 adb shell am start -a android.intent.action.VIEW
832 <p>Within an adb shell, you can issue commands with the package manager ({@code pm}) tool to
839 <p>You can also issue a package manager command directly from adb
842 adb shell pm uninstall com.example.MyApp
1102 <p>From an adb remote shell, you can use the
1118 <pre class="no-pretty-print">adb -s emulator-5554 shell
1126 shell. To exit and return to the adb remote shell, use <code>exit</code> or <code>CTRL+D</code>.
1141 $ adb shell screenrecord /sdcard/demo.mp4
1147 <p>Here's an example recording session, using the adb shell to record the video and the
1151 $ adb shell
1155 $ adb pull /sdcard/demo.mp4
1238 <pre class="no-pretty-print">adb shell monkey -v -p your.package.name 500</pre>
1251 <pre class="no-pretty-print">adb shell ls /system/bin</pre>
1255 <p>Table 5 lists some of the more common adb shell commands.</p>
1257 <p class="table-caption"><strong>Table 5.</strong> Some other adb shell commands</p>
1320 <pre class="no-pretty-print">[adb] logcat [option] ... [filter-spec] ...</pre>
1322 <p>You can use the <code>logcat</code> command from your development computer or from a remote adb shell in an emulator/device instance. To view log output in your development computer, you use</p>
1324 <pre class="no-pretty-print">adb logcat</pre>
1326 <p>and from a remote adb shell you use</p>
1336 <h2 id="stopping">Stopping the adb server</h2>
1338 <p>In some cases, you might need to terminate the adb server process and then restart it. For example, if adb does not respond to a command, you can terminate the server and restart it and that may resolve the problem. </p>
1340 <p>To stop the adb server, use the <code>kill-server</code> command.
1341 You can then restart the server by issuing any other adb command. </p>