Diferencia entre revisiones de «Usuario:Juanda/android/adb»

De WikiEducator
Saltar a: navegación, buscar
(Página creada con '{{Usuario:juanda/android/nav }} {{#widget:Slides}} {{MiTitulo| Curso de Android}} <div class="slides layout-regular template-default"> <div class="slide"> Habilitar el modo de …')
 
Línea 5: Línea 5:
 
Habilitar el modo de depuración por USB:  Esta opción es una casilla que debéis marcar en "Ajustes->Aplicaciones->Depuración USB". A partir de ahora deberíamos acostumbrar-nos a tener siempre esta casilla marcada, ya que en caso de problemas con esta modalidad funcionando podremos conectarnos al aparato mediante el programa ADB para intentar salvar el dispositivo.
 
Habilitar el modo de depuración por USB:  Esta opción es una casilla que debéis marcar en "Ajustes->Aplicaciones->Depuración USB". A partir de ahora deberíamos acostumbrar-nos a tener siempre esta casilla marcada, ya que en caso de problemas con esta modalidad funcionando podremos conectarnos al aparato mediante el programa ADB para intentar salvar el dispositivo.
 
</div>
 
</div>
 +
 +
== What is adb? ==
 +
 +
[[wikipedia:Android_Debug_Bridge|ADB]] ("<code>adb</code>"), or the Android Debug Bridge, is a development tool included with the [[sdk|Android SDK]] (Software Developer Kit), which allows for communication from an Android device (such as a phone or tablet) to a personal computer, and vice-versa.  This communication can be made over a wifi connection.  However more commonly, it is made via a USB cable.  <code>adb</code> can also be used by developers for communicating from a computer to a virtual android machine that is also running on the computer.
 +
 +
<code>adb</code> is the "Swiss-army knife" of Android development.  It provides numerous functions that can be accessed in detail via the command: <code>[[adb --help]]</code>
 +
 +
== Popular adb commands ==
 +
 +
Among the most popular among CyanogenMod include the following, which can be typed from a Terminal program on the attached computer:
 +
 +
* <code>adb shell</code> -- this command establishes a [[wikipedia:shell (computing)|shell]] interface for establishing a [[wikipedia:command-line interface|command-line]] session with the device.  In practical purposes, this allows a person to type "into" their devices, much as one would use a terminal program a Linux or Mac OS X.  Individual shell commands can be sent to the device by typing <code>adb shell <command_to_be_executed_on_the_device></code>
 +
 +
* <code>adb push <local> <remote></code> -- this command pushes a local file on the computer to a remote file on the device.  You can include the full path to either the local or remote file.
 +
 +
* <code>adb pull <remote> [<local>]</code> -- this command will pull a remote file on the device (you can include the path) to either a specified location on the computer or, if no destination is specified, to the current directory where the command was issued.
 +
 +
* <code>adb logcat</code> -- this command allows you to view the device log in real time.  It is also very [[Doc:_debugging_with_logcat|useful for discovering and reporting bugs]].
 +
 +
* <code>adb install <file></code> -- this is used to "[[Basic_concepts#"side-loading"|side-load]]" apps (in their .apk format) to the device.
 +
 +
There are many more useful commands.  Check out the full instruction list [[adb --help|here]].
 +
 +
== Downloading and installing <code>adb</code> ==
 +
 +
Although <code>adb</code> can be downloaded as a simple binary, perhaps the best way to get adb is to install the [[sdk|Android SDK]] directly from Google.  That will ensure that, as <code>adb</code> is updated with the rest of the SDK, you can always have the latest version.  <code>adb</code> will be located in the <code>/platform-tools</code> directory inside the SDK directory.
 +
 +
==New behavior as of Android 4.2.2==
 +
 +
In Android 4.2.2, Google implemented some new security features for using <code>adb</code>. This requires you accept the shell session prompt from within your ROM once past whatever unlock mechanism you use for the lock screen. In order to access your device via <code>adb</code> within a booted ROM, you '''MUST''' download the latest [[sdk|Android SDK]] and '''kill''' any existing <code>adb</code> daemon sessions to proceed. Once you receive the prompt on your device, you may check the 'trust this computer' box to not be prompted again when connecting your device to that specific PC.
 +
 +
== Troubleshooting <code>adb</code> ==
 +
 +
{{Paths}}
 +
 +
=== "Device not found" errors ===
 +
 +
Sometimes adb can't find your device.  One solution is to run <code>adb kill-server</code> and then <code>adb start-server</code> as root or Administrator to restart the adb daemon with elevated privileges.
 +
 +
Also, you should make sure that the '''USB debugging''' or '''Android Debug Bridge''' option (this will vary depending on the version of Android) is checked in the '''Settings''' under '''Developer Options'''.
 +
 +
{{note|note=Some devices require a file at <code>.android/adb_usb.ini</code> be added to help your computer find the correct device.  For example, the "encore" device requires that this file include a line containing <code>0x2080</code>, the identification code for the device.  If you have installed adb and are unable to find the device, you may wish to inquire as to whether this may be the case for your device.}}
 +
 +
=== libncurses.so.5 64-bit troubles ===
 +
Under 64bits version of Linux Mint 14 and maybe other Debian/Ubuntu flavours <code>adb</code> shows the following error:
 +
./adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
 +
 +
You can solve it by installing '''libncurses5''' i386's version. Just type <code>apt-get install libncurses5:i386</code> as root.

Revisión de 05:40 10 abr 2013


Habilitar el modo de depuración por USB: Esta opción es una casilla que debéis marcar en "Ajustes->Aplicaciones->Depuración USB". A partir de ahora deberíamos acostumbrar-nos a tener siempre esta casilla marcada, ya que en caso de problemas con esta modalidad funcionando podremos conectarnos al aparato mediante el programa ADB para intentar salvar el dispositivo.

What is adb?

ADB ("adb"), or the Android Debug Bridge, is a development tool included with the Android SDK (Software Developer Kit), which allows for communication from an Android device (such as a phone or tablet) to a personal computer, and vice-versa. This communication can be made over a wifi connection. However more commonly, it is made via a USB cable. adb can also be used by developers for communicating from a computer to a virtual android machine that is also running on the computer.

adb is the "Swiss-army knife" of Android development. It provides numerous functions that can be accessed in detail via the command: adb --help

Popular adb commands

Among the most popular among CyanogenMod include the following, which can be typed from a Terminal program on the attached computer:

  • adb shell -- this command establishes a shell interface for establishing a command-line session with the device. In practical purposes, this allows a person to type "into" their devices, much as one would use a terminal program a Linux or Mac OS X. Individual shell commands can be sent to the device by typing adb shell <command_to_be_executed_on_the_device>
  • adb push <local> <remote> -- this command pushes a local file on the computer to a remote file on the device. You can include the full path to either the local or remote file.
  • adb pull <remote> [<local>] -- this command will pull a remote file on the device (you can include the path) to either a specified location on the computer or, if no destination is specified, to the current directory where the command was issued.
  • adb install <file> -- this is used to "side-load" apps (in their .apk format) to the device.

There are many more useful commands. Check out the full instruction list here.

Downloading and installing adb

Although adb can be downloaded as a simple binary, perhaps the best way to get adb is to install the Android SDK directly from Google. That will ensure that, as adb is updated with the rest of the SDK, you can always have the latest version. adb will be located in the /platform-tools directory inside the SDK directory.

New behavior as of Android 4.2.2

In Android 4.2.2, Google implemented some new security features for using adb. This requires you accept the shell session prompt from within your ROM once past whatever unlock mechanism you use for the lock screen. In order to access your device via adb within a booted ROM, you MUST download the latest Android SDK and kill any existing adb daemon sessions to proceed. Once you receive the prompt on your device, you may check the 'trust this computer' box to not be prompted again when connecting your device to that specific PC.

Troubleshooting adb

Plantilla:Paths

"Device not found" errors

Sometimes adb can't find your device. One solution is to run adb kill-server and then adb start-server as root or Administrator to restart the adb daemon with elevated privileges.

Also, you should make sure that the USB debugging or Android Debug Bridge option (this will vary depending on the version of Android) is checked in the Settings under Developer Options.

Plantilla:Note

libncurses.so.5 64-bit troubles

Under 64bits version of Linux Mint 14 and maybe other Debian/Ubuntu flavours adb shows the following error:

./adb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
You can solve it by installing libncurses5 i386's version. Just type apt-get install libncurses5:i386 as root.