ADB

From iDroidWiki

Revision as of 09:58, 15 December 2021 by Ricky26 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ADB or Android Debug Bridge is the main way to communicate and change files on the android system. ADB allows you to send and receive files based on the commands sent. ADB is found in the Android SDK.

Majority of the Guides in the iDroidWiki use ADB commands, so please know what and how to use ADB for maximum success with the other guides.

Contents

Getting Started

Disclaimer

To quote someone, if you do not know why "rm -rf /" is a bad idea, read everything first until you understand. Then once you understand, proceed to doing what you want to do with ADB.

Installing in Linux

  1. Install the udev rules, see udev Rules.
  2. Download the Android SDK
  3. Extract the archive
  4. In the tools folder, you will find the adb file used to connect to your phone

Installing in Windows

  1. On Windows, download and install the OIB tools from here.

Installing in Mac

Run Terminal and type:

cd Downloads
wget http://dl.google.com/android/android-sdk_r07-mac_x86.zip
unzip android-sdk_r05-mac_86.zip
tar xzvf android-sdk_r05-mac_86.zip
echo "PATH=$PATH:~/Downloads/android-sdk-mac_86/tools" >> ~/.profile
restart terminal

Connecting

Getting your iDroid's IP Address

  1. Make sure that your iDroid is connected to the same network as the PC that will be using ADB.
  2. Connect to that WiFi network if you haven't.
  3. Once connected to WiFi in iDroid, go to Settings > Wireless & network settings > Wi-Fi settings.
  4. Under the WiFi networks heading, look for the network that you are connected to. You know you are connected to this network because the word Connected is under the network's SSID. It also has the WiFi signal icon to its right (not a check mark).
  5. Touch that network and a window box will appear with the IP address. Copy the IP address.

Connecting in Linux

  1. Open a Terminal in Linux (NOT iDroid's Terminal Emulator).
  2. To initialize the connection, enter:
./adb connect xxx.xxx.xxx.xxx:5555

or

tools/adb connect xxx.xxx.xxx.xxx:5555

Where xxx.xxx.xxx.xxx is your iDroid's IP Address

If all goes well, a message should say that you are connected to your phone.

Connecting in Windows

  1. Open command prompt (Start -> Run -> "cmd")
  2. To initialize the connection, enter:
adb connect xxx.xxx.xxx.xxx:5555

Where xxx.xxx.xxx.xxx is your iDroid's IP Address

If all goes well, a message should say that you are connected to your phone.

Connecting in Mac

  1. Open Terminal in Mac (NOT in iDroid's Terminal Emulator)
  2. To initialize the connection, enter:
adb connect xxx.xxx.xxx.xxx:5555

Where xxx.xxx.xxx.xxx is your iDroid's IP Address

If all goes well, a message should say that you are connected to your phone.

Shell

ADB Shell is Android's mini Terminal. Commands in Shell are similar to those one uses in Linux Terminal. To go into Shell, ADB must be connected, then in Linux Terminal or Windows Command prompt enter: For Linux Terminal

./adb shell

For Windows Command Prompt

adb shell

A console with "#" at the start of the line shows you are in the Shell.

Sending/Receiving Data

To send or receive data, the partition has to be mounted and changed to read/write capabilities in shell.

mount -o remount,rw -t yaffs2 /dev/mtdblock3 /system

After the file system has been mounted, you can now send and receive data from the phone, using:

adb push /path_to_where_the_file_is /system/location_on_phone
adb pull /system/location_on_phone /path_to_where_the_file_is

These two commands will send/receive data from the phone.

Other Useful Commands

Reboot: reboots the phone when used in shell, safer way to shut down phone vs hard reset.

ADB kill-server disconnects ADB and terminates the ADB process.

Troubleshooting

Error messages may appear upon entering commands in ADB Shell. These errors often happen with a rooted device and is caused by the modified su.

# command
[1] + Stopped (signal)        command
# command
[1]   Segmentation fault      command

The workaround for these errors is to simply reenter the command. A new kernel can help minimize these errors.

GUI Frontend

ADB now has GUI for Windows and Linux (Mac - not yet). For more information check the links bellow.

ADB GUI For Windows

ADB GUI for Linux

External Links

See the Developer Guide for more info.

Personal tools
Namespaces
Variants
Actions
Wiki
Community
Toolbox