GSM Shop GSM Shop
GSM-Forum  

Welcome to the GSM-Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features.
Only registered members may post questions, contact other members or search our database of over 8 million posts.

Registration is fast, simple and absolutely free so please - Click to REGISTER!

If you have any problems with the registration process or your account login, please contact contact us .

Go Back   GSM-Forum > GSM & CDMA Phones / Tablets Software & Hardware Area > Android based Phones / Tablets > Android Development and Modding


Reply
 
LinkBack Thread Tools Display Modes
Old 11-26-2013, 13:34   #1 (permalink)
No Life Poster
 
Faheem Anjum's Avatar
 
Join Date: Nov 2006
Location: (United States Of Islam)
Age: 37
Posts: 24,984
Member: 399832
Status: Offline
Sonork: Faheem Anjum
Thanks Meter: 24,310
Donate money to this user
Wink A Comprehensive Guide to ADB (Android Debug Bridge) and Commands





f you have been in relation with the Android sphere, I assume you know of what ADB is. Even if you don’t, you shall now recite it as here we’re going in to a little depth about the same. We will begin out journey with defining and explaining its structure, commands and end it with setting it up and exploring its daily applications for Android users/developers . Lets now lean forward towards the basic, followed by the complications.
This guide and the information indulged in it, is meant for anyone and everyone related to Android. You shall find its necessity at several occasions like taking logs, flashing firmware images, updating phone software, flashing ROMs/Recoveries & even while developing a ROM/Kernel/Application. So, from users to developers, it will come in handy.
What is ADB?

ADB or Android Debug Bridge, is a fully equipped and loaded command-line tool which is put to use in order to communicate with an Android device. ADB tool is provided along side the Android SDK and one could easily find this tiny but versatile tool under <SDK>/platform-tools/
It comprises of three basic and important components:
  • The Client
    It is what runs on your development machine
  • The Server
    It is held responsible for communication between the client and daemon running on a device/emulator
  • The Daemon
    It runs as a background process on each device/emulator instance
Now, lets see how can a user set up ADB on his various OS incl. Windows, Linux & Mac. Since ADB is bundled with Android SDK, so you need it prior for your respective OS. Below are few easy steps to setup ADB easily on your OS without much hassle. SDK and ADB work on JAVA, so make sure that you have JDK6 or higher running on your OS.

How to Setup ADB on Windows

  1. Download the Android SDK package for Windows [android-sdk_r21.1-windows.zip]
  2. Extract the zip files to your C:\ drive. Now you have a folder android-sdk-linux
  3. Double click on SDK Manager to initiate the SDK manager. You shall perceive the following window.
  4. Make sure everything is un-ticked. Now select Android SDK Platform-tools and install it.
  5. During the next window, you will be prompted. Accept the license and click on Install.
  6. When the installation is complete, close the window.
  7. The SDK manager has now download the platform-tools successfully, which certainly includes our prior ADB.
  8. The next step is to define the path where ADB is present.
  9. Go to C:\android-sdk-windows\platform-tools and take note of this path.
  10. Go to desktop, right click on Computer and select Properties.
  11. On the left pane, click on Advanced System Settings and a new window shall open.
  12. Select Environment Variables under Advanced tab.
  13. Select Path variable and click edit.
  14. Now add the path we noted in step #9 to the variable value and hit OK.
  15. Confirm and apply all the changes.
  16. To confirm that ADB has been configured properly, open CMD window and type in:adb
  17. You now have ADB successfully installed and configured on your Windows machine.

How to Setup ADB on Linux

You can setup ADB easily on any Linux distribution including Ubuntu, Fedora, openSUSE, Linux Mint etc.
  1. Download the Android SDK package for Linux [android-sdk_r21.1-linux.tgz]
  2. Place the downloaded file in your “HOME” folder.
  3. Right click on the file and select Extract here
  4. Now, you shall see a folder named android-sdk-linux.
  5. Open the terminal in the Home folder and type in the following commands:cd android-sdk-linux/tools./android
  6. Make sure everything is un-ticked. Now select Android SDK Platform-tools and install it.
  7. During the next window, you will be prompted. Accept the license and click on Install.
  8. When the installation is complete, close the window.
  9. The SDK manager has now download the platform-tools successfully, which certainly includes our prior ADB.
  10. The next step is to define the path where ADB is present.
  11. Open the terminal again and type in the following commands to add the SDK Path to the .bashrc & .profile. Here “gedit” is the default text editor in Ubuntu. In case you are running other Linux distribution, replace it with the name of the corrospoding text editor. For example, in case of linux mint, you shall use: gksudo pluma ~/.bashrc and so on for other distributions.gksudo gedit ~/.bashrc
  12. Go towards the end and add the following lines:# Android tools export PATH=${PATH}:~/android-sdk-linux/tools export PATH=${PATH}:~/android-sdk-linux/platform-tools export PATH=${PATH}:~/bin
  13. Lets do the same for .profile. Open Terminal and type:gksudo gedit ~/.profile
  14. Scroll to the very end of the file and add the following line:PATH="$HOME/android-sdk-linux/tools:$HOME/android-sdk-linux/platform-tools:$PATH"
  15. Reboot your system now to take effect.
  16. To confirm the configuration, open Terminal and type:adb
  17. You have now successfully installed and configured ADB on your Linux machine.

How to Setup ADB on Mac OS

At present Android SDK and its components like ADB only supports systems running Mac OS X 10.5.8 or higher. So, make sure that you meet the requirement.
  1. Download the Android SDK package for Mac OS [android-sdk_r21.1-macosx.zip]
  2. Extract the downloaded zip package to your Home directory.
  3. Now, you shall see a folder named android-sdk-macosx
  4. Navigate inside android-sdk-macosx/tools/
  5. Double-click “android” to execute the SDK Manager.
  6. Make sure everything is un-ticked. Now select Android SDK Platform-tools and install it.
  7. During the next window, you will be prompted. Accept the license and click on Install.
  8. When the installation is complete, close the window.
  9. The SDK manager has now download the platform-tools successfully, which certainly includes our prior ADB.
  10. The next step is to define the path where ADB is present.
  11. Open terminal window and type following:nano ~/.bash_profile
  12. This shall open the .bash_profile file. Now enter the following line to define ADB path.export PATH=${PATH}:~/android-sdk-macosx/tools export PATH=${PATH}:~/android-sdk-macosx/platform-tools
  13. Reboot your system now to take effect.
  14. To confirm the configuration, open Terminal and type:adb
  15. You have now successfully installed and configured ADB on your Mac OS machine.

ADB Commands

ADB commands are independent of the OS you’re using them on. Once you have setup the SDK and hence, the ADB, you can move forward and make use of any of these commands upon your requirement. Lets hit the basic commands.
  1. What if you connected your Android device to your machine and you want to make sure that its correctly detected? You got to put in use this simple command.adb devicesNow, what it does is, start a daemon (background process) and output the device debugging serial. So, if it does so, then you can be sure that your device has made a successful connection with the machine.
  2. The second most made-in-use command is logcat. Most used, because its not only used by users to report the errors in Apps, Kernel, ROMs etc but also by the developers to track the bugs and fix them. So, it holds a great importance in Android development.
    Once, you have started to log, you also need to put a barrier of stopage when you think that you have acquired sufficient knowledge about what you seek, to do this press Ctrl + C.Logcat command can itself be used in several ways. To display a real-time log of the device, Its best to take a log since boot, which gives a more appropriate knowledge. This command in most cases is used by developers to simply take note of the log of their developed Apps, ROMs, Kernels etc. To take in a real-time log, type the following command in your CMD (Windows) or Terminal (Linux/Mac).adb logcatCases arise when you’re a user and at certain situations, you’re required to take note of the log and upload it for the developer assistance/help. But, recording the log over CMD/Terminal is pretty messy and so this command makes it simple. What it shall do is, take the log and store it decently in a .txt file, so that a user can carry it or transfer it easily. Again, its better to log since boot until you are considerate about logging a single process. Type in the following command:
    adb logcat > logcat.txtHere, “logcat.txt” is the name of the file, you may vary it in accordance to your needs. For Eg. adb logcat > ROMlogcat.txt
    The same file shall be stored in C:\Users\<username> for Windows & Linux
  3. Pull/Push commands hold equivalent importance as it saves the trouble of manually extracting a specific apk using a file manager with Root permissions and then transferring it to the PC. What it does is, directly pull out/push in the desired apk from/to any location under the device without much hassle.To pull an apk file, type:adb pull <filepath)eg. adb pull /system/app/SystemUI.apk
    To push/copy over an apk file to the device, type:
    adb push <filename> <filepath>eg. adb push SystemUI.apk /system/app/SystemUI.apk
    NOTE: The file names and file paths in these commands are case-sensitive. Also, in case of system apks, its advised to first mount using the following command.
    adb remount
  4. There are several occasions when a user has to use his device accessed in shell mode and ADB makes it easier. To initiate a shell connection with the device/emulator, type in the following command:adb shellWhile in the ADB shell, a user has access to some unique and new commands which are as following:
    cd <path>The above commands changes the CMD/Terminal directory to a specified directory inside the Android device/emulator.
    e.g: cd /system/app
    ls <path>The above command lists all the files in the current shell directory
    e.g: ls /system/app
    rm <file_path>The command removes a specified file from the directory
    e.g: rm /system/app/SystemUI.apk
    cp <file_path> <copy_path>The command copies a specified file to another location
    eg. cp /system/app/SystemUI.apk /sdcard/SystemUI.apk
    To exit the shell, type:
    exit
  5. Booting commands also hold their place and come in very handy while rooting processes and even while Android development. Below are stated such 3 commands:adb rebootThe command simply reboots your device at any instance
    adb reboot recoveryThe command reboots a device into recovery mode
    adb reboot bootloaderThe command reboots a device into its bootloader (fastboot) mode
  6. In case you’re in bootloader mode, your device shall never show any response to ADB commands. But, here comes fastboot in action, which has a limited, but a few and very useful commands. This is the same reason that bootloader mode is often referred to as fastboot mode.fastboot devicesDisplays the device ID of the Android device connected while in bootloader mode.
    fastboot rebootReboots a device
    fastboot reboot-bootloaderReboots the bootloader
    fastboot oem unlockInitiates the bootloader unlocking sequence
    fastboot oem lockRe-locks the device bootloader
    fastboot flash recovery <recovery_image_name.img>Flashes a recovery image to the device
    eg: fastboot flash recovery clockworkmod-6.0.3.1_mako.img
    fastboot flash radio <radio_file_name.img>Flashes the Radio (baseband) image file
    eg. fastboot flash radio radio-crespo-i9020xxki1.img
    fastboot flash bootloader <bootloader_file_name.img>Flashes a bootloader image to the device partition
    eg. fastboot flash bootloader bootloader-crespo-i9020xxlc2.img

This is all! We’ve guided you setup Android SDK, ADB and use the simple command-line tool. We do not expect everyone to grasp this knowledge all at once, so in case you’re in any trouble while setting up or while using these commands, comment below and we shall give you an helping hand
  Reply With Quote
The Following 20 Users Say Thank You to Faheem Anjum For This Useful Post:
Show/Hide list of the thanked
Old 12-11-2013, 14:17   #2 (permalink)
Junior Member
 
Join Date: Oct 2010
Posts: 4
Member: 1412804
Status: Offline
Thanks Meter: 0
the terminal close itself when i double click the sdk manager.
  Reply With Quote
Old 10-09-2014, 07:43   #3 (permalink)
Junior Member
 
Join Date: Sep 2014
Posts: 4
Member: 2265803
Status: Offline
Thanks Meter: 0
Is it mandatory to set up the path...as far as i know it works with eclipse without any path set-up, looking forward for suggestions.
  Reply With Quote
Old 12-14-2014, 20:28   #4 (permalink)
Junior Member
 
Join Date: Dec 2014
Location: South Afrcia
Posts: 13
Member: 2310127
Status: Offline
Thanks Meter: 0
adb

Hello,
Thanks for info in this posting.
Can abd help me edit touch screen config?
I replaced broken touch digitiser on my Tronsmart TS7 and not touch is inverted and split.
Touch left executes right, touch left executes right. Touch top left executes bottom right. Touch top half and executes further up to opposite side.

Thanks in advance.
  Reply With Quote
Old 10-27-2015, 08:56   #5 (permalink)
Cheater -Don't Deal with him-
 
Join Date: Apr 2008
Location: California USA
Posts: 679
Member: 743601
Status: Offline
Sonork: 83392409
Thanks Meter: 138
Donate money to this user
Quote:
Originally Posted by alva114 View Post
Great work.. Keep it up
spam full the trigger on thanks botton
  Reply With Quote
The Following 2 Users Say Thank You to shanryzen For This Useful Post:
Old 04-09-2016, 16:39   #6 (permalink)
Junior Member
 
Join Date: Nov 2014
Posts: 3
Member: 2290704
Status: Offline
Thanks Meter: 0
can i take backup with adb if i forgot pattern???
if yes then how???
  Reply With Quote
Old 04-12-2016, 04:50   #7 (permalink)
Freak Poster
 
Benntek's Avatar
 
Join Date: Sep 2015
Location: Mainland
Posts: 409
Member: 2461747
Status: Offline
Thanks Meter: 41
Can I use adb to on my phone debugging when it looks with pattern and the debugging is off
  Reply With Quote
Old 05-09-2016, 03:46   #8 (permalink)
Insane Poster
 
Join Date: Dec 2015
Posts: 62
Member: 2494369
Status: Offline
Thanks Meter: 2
i also locking solution for to take backup with adb if i forgot pattern???
if yes then how???
  Reply With Quote
Old 05-28-2016, 06:58   #9 (permalink)
Junior Member
 
Join Date: May 2016
Location: India
Posts: 22
Member: 2577936
Status: Offline
Thanks Meter: 23
Donate money to this user
How to enable usb dubbing commnd please hlp me sir
  Reply With Quote
Old 06-24-2016, 14:56   #10 (permalink)
Junior Member
 
Join Date: Jun 2016
Posts: 1
Member: 2590442
Status: Offline
Thanks Meter: 0
Need More updates....it's helpfull for me and my andr
  Reply With Quote
Old 08-31-2016, 11:50   #11 (permalink)
Junior Member
 
Join Date: Aug 2016
Posts: 9
Member: 2616562
Status: Offline
Thanks Meter: 3
You have now successfully installed and configured ADB on your Linux machine.
  Reply With Quote
The Following User Says Thank You to ciejnr For This Useful Post:
Old 01-15-2017, 09:05   #12 (permalink)
Junior Member
 
Join Date: Jan 2017
Posts: 8
Member: 2672786
Status: Offline
Thanks Meter: 0
Assalam O Alaikum I am new here
  Reply With Quote
Old 01-31-2017, 19:14   #13 (permalink)
Freak Poster
 
Join Date: Jul 2012
Location: Trinidad
Posts: 163
Member: 1779577
Status: Offline
Sonork: 100.1622810
Thanks Meter: 11
How can I used cmd to activate usb debugging?
  Reply With Quote
Old 02-02-2017, 11:33   #14 (permalink)
Junior Member
 
Join Date: Sep 2016
Posts: 4
Member: 2627274
Status: Offline
Thanks Meter: 1
Nice thread. Techno release provides tips and information related to android mobiles, iOS and other software related problems.
  Reply With Quote
Old 02-02-2017, 15:28   #15 (permalink)
Junior Member
 
Join Date: Oct 2012
Posts: 3
Member: 1825074
Status: Offline
Thanks Meter: 2
Most the phone be in adb modemode?
  Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 



All times are GMT +1. The time now is 13:47.



Powered by Searchlight © 2024 Axivo Inc.
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -
Page generated in 0.29430 seconds with 9 queries

SEO by vBSEO