Elite Member

Happy to Help!!

Rank: 6Rank: 6

Credits
16040
Device
Redmi Note 3
Online time
710 Hours
Send PM

Yeelight Bedside LampMi BoxMi In-Ear HeadphonesMi BandMi  BunnyMIUI 7I Love MIUIMIUI 6Fantastic!Awesome!MIUI 8Xiaomi Mi 4Mi 3Mi TVRedmiRedmi Note 3Mi 4cPokemon Master MedalMIUI Fan from MalaysiaDiwali MIUI 300 WeeksHappy Diwali1400K Forum MembersXiaomi 6th Anniversary2014 ChristmasMIUI Fan From PhilippinesUEFA EURO Medal1500K Forum MembersMIUI 4th AnniversaryMIUI Fan from IndiaMIUI Fan From IndonesiaFan Of MIUI Ex-Yu 300K Forum MembersFan Of MIUI IndiaSummer Mi BunnyAlpaca Mi Bunny Gamer Mi BunnyMIUI Device TeamStar Of IconsMIUI FB FollowerDie-hard MIUI FanUpdates LoverAndroid GuruPioneer of MIUI English Forum Inbox ZeroForum Contest LoverDebate MasterRedmi Quiz MasterMi Lover MedalScroll Of WisdomYouth PledgeMi Bunny Game Master MIUI Android 4.4 KitKatMIUI FollowerMIUI Device ExpertTechnology GuruMi TalentMIUI Global Forum 2014

[Tools, Tips & Tutorials] [DEVICE TEAM][ANDROID BASICS] Introduction to ADB Mode - Everything You Need!!

  [ Promote]
32409 296 |
19:50, Jan-13-2017 | From PC
|
|
Go to reply no.
ADB.jpg

Hello MIUI-ers,
I am back with some basic stuff again, if you remember I started this series of Android Basic thread with [ANDROID BASICS] Introduction to Fastboot Mode - Noob friendly! If you are new to this then I will recommend you to read that thread first because ADB and fastboot are always limked together. So let's get started.

Android Debug Bridge
ADB, Android Debug Bridge, is a command-line utility included with Google’s Android SDK. ADB can control your device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands, and more. When we've broken something and need to fix it, there are plenty of reasons why an advanced Android user would want to talk to his or her device. To do that, you need to have a few tools and know a few commands. That's what we're going to talk about today.
Android Debug Bridge is a versatile command line tool that lets you communicate with an emulator instance or connected Android device. It facilitates a variety of device actions, such as installing and debugging apps, and it provides access a Unix shell that you can use to run a variety of commands on an emulator or connected device. It is a client-server program that includes three components:

  • A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
  • A daemon, which runs commands on a device. The daemon runs as a background process on each emulator or device instance.
  • A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.

Setting up ADB in PC Environment
At the initial stages, you have to install the entire Android SDK and platform tools for accessing fastboot commands, but thanks to the developer shimp208 now you only need the minimal adb and fastboot installer for setting up fastboot and ADB. I am going to describe all the steps in a detailed way here.

Step 1. Download Pdanet for installing the proper drivers for your device.


Step 3. Download the ADB folder which contains the latest r23 fastboot and adb files.

Step 4. Install the Pdanet and follow as per the instruction given in the installation wizard, here you need to put your device into USB debugging and that's normal and for smooth working you should enable USB debugging.

Step 5. Install the Minimal adb and fastboot installer and copy the ADB folder where ever you want to keep. Remember that when you want to use ADB commands you should go to this ADB folder.

Step 6. Open cmd in the ADB folder by Pressing shift+Right mouse click, from the options select "Open command window here".

Step 7. Connect your device again and type the following in the command window.

  1. adb devices
Copy the Code

In response, adb prints this status information for each instance:

  • Serial number — A string created by adb to uniquely identify an emulator/device instance by its console port number. The format of the serial number is type-console-port. Here's an example serial number: emulator-5554


  • State — The connection state of the instance may be one of the following:
    • offline — the instance is not connected to adb or is not responding.
    • device — the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance.
    • no device — there is no emulator/device connected.

For us, we will see a message like below:
ADBWireless.jpg

Now you are good to go, if you are not getting the above message then you should check my thread, Fix ADB device - Unauthorized/waiting for device/Offline errors!!

ADB Commands

  • adb reboot
    1. adb reboot
    Copy the Code
    This command reboot the device into system.

  • adb reboot-bootloader
    1. adb reboot-bootloader
    Copy the Code
    This command reboot the device into fastboot commands.

  • adb push
    1. adb push <local_Path_of_file> <remote_Path_where_file_to_be_copied>
    Copy the Code
    Let’s see how to do this. First it is required to start a remote shell in the target emulator/device instance and find remote path to copy the file. E.g. To copy the file to sdcard

    • ls -l | grep “storage” – List files/directories with name storage
    • cd storage – Changed current directory to ‘storage’
    • ls -l | grep “sdcard” – List files/directories with name sdcard
    • cd sdcard1 – Changed current directory to ‘sdcard1’ = storage/sdcard1
    • ls -l  – List all the files/directories in sdcard1
    • pwd – See current path, this is remote path



    Now the command to push the Amazon apk fill be: adb push C:\Apps\Amazon\in.amazon.mshop.android.shopping.apk /storage/sdcard1



  • adb pull
    1. adb pull <remote_Path_of_file_on_device> <local_Path_where_file_to_be_copied >
    Copy the Code
    You need to specify the location of the file you want to pull and the location where you want to copy the file.

  • adb shell
    1. adb shell
    Copy the Code

    ADB provides a Unix shell that can be used to run a variety of commands on an emulator or connected device. The command binaries are stored in the file system of the emulator or device. The following commands can be executed on shell:
    1. getprop ro.product.model
    Copy the Code
    This command get’s the attached device model no

    1. getprop ro.build.version.release
    Copy the Code
    This command get’s the android build release version i.e. 4.4.2/4.4.4
    1. getprop ro.build.version.sdk
    Copy the Code
    This command gets the device api version i.e. 19,20,21,22

    1. pm list packages –f
    Copy the Code
    Using pm (package manager tool) we can perform actions and queries on app packages installed on device. E.g. we are listing all packages with path of their associated file.


    Note: Here pm is a tool and list package is a command and –f is an option to list path of file associated with package.
    The above command can also be utilized to print the package of installed apps. E.g. Android browser’s app package can also be printed with this which is installed on the device.
    1. pm list packages –f | grep “chrome”
    Copy the Code
    1. pm uninstall <app Package Name>
    Copy the Code
    This can be used to uninstall an app using pm tool as per above mentioned command.


    Step 1. To get the package for Amazon app
    Step 2.
    Uninstall Amazon Package
    Step 3. Again to get the package for Amazon app, this time it will not displayed anything, as Amazon app is now uninstalled from the device.

  • adb logcat
    1. adb logcat
    Copy the Code
    1. adb logcat > <local_path_to_text_file>
    Copy the Code
    adb_Command_5.png

    The adb logcat command is one of the most useful commands for some folks, but just prints a bunch of gibberish unless you understand what you're seeing. It returns the events written to the various logs in the running Android system, providing invaluable information for app developers and system debuggers. Most of us will only run this one when asked by one of those developers, but it's very important that we know how to use it correctly.

  • adb install
    1. adb install <local_path_to_apk>
    Copy the Code
    This command will install the apk file to attached device / emulator


I guess this tutorial will help a lot of user's to understand what is ADB and how can it be made useful. I have covered almost all the basic aspects of ADB mode and I think this is enough for a basic user. If you want anymore topic to cover or you have some query on the topic please feel free to comment on this thread. If you want to include a topic in this "Android Basics" series please comment the topic under this thread and the topic which most users asked or relevant will be considered and added in the coming threads.

Credits: Google, Android and Vivek for the screenshots.

Thank you and regards,
Raaj

Favorite273 Share

Rated by 53 people   Experience Prestige Reason  

Transvamp + 1 Awesome!
Sujayb + 10 + 3 Fantastic!
Conquest00 + 1 Great!
JimmelRN4 + 2 Great!
feds64 + 10 + 5 Fantastic!
33260720 + 1 Great! Nice to have most of important co
Vitol72ru + 1 Thanks!
isurenK + 1 Fantastic!
mcfive05 + 1 Fantastic!
xiaumibitor + 1 Fantastic!
Ahad-Hossain + 10 + 3 Fantastic!
dandismund + 2 Thanks!
foxsaone + 1 Thanks!
1633012781 + 2 Thanks!
BoceMiPad + 2 Thanks!
gundex + 1 Awesome!
Specializedepic + 1 Awesome!
vavev + 1 Thanks!
xzywkq + 1 Awesome!
Abhie131180 + 1 Fantastic!
rahul_09 + 5 Awesome!
Lemurka + 1 Great!
SoNik+ + 1 Great!
well-zone + 1 Thanks!
NikolayBUL + 5 Great!
BharatG + 10 + 5 Fantastic!
xest-relax + 1 Thanks!

Experience +182  Prestige +35  View Rating Log

Diamond Member

Rank: 5Rank: 5

Credits
1162
Device
Redmi Note 3
Online time
7 Hours
Send PM

Xiaomi 6 LaunchMi VR HeadsetMIUI Devices ContestRedmi Note 3MIUI Lucky Friday3 Million Forum App InstallsRooster Year of 2017Fan Of MIUI Ukraine3500K Forum MembersSuper ThursdayMIUI 2017Die-hard MIUI FanDebate MasterForum Contest LoverMi Story TellerScroll Of WisdomMost Popular Forum UserAndroid Guru

19:53, Jan-13-2017 | Via mobile
|
thanks for the basics

Supreme Member

Rank: 7Rank: 7Rank: 7

Credits
131171
Device
Mi MIX 2S
Online time
93 Hours
Send PM

Unlock MedalMi Band 2Awesome!MIUI Devices ContestXiaomi Mi 6Rooster Year of 2017MIUI 20171800K Forum Members1 Million Forum App InstallsMIUI Drawing TalentMIUI Fan from MalaysiaSuper MondayMIUI 9Surge S1Gamer Mi BunnyMIUI Weekly Devices QuizSurpriseForum Contest LoverMi Lover MedalMIUI FollowerDebate Master

20:02, Jan-13-2017 | From PC
|
Thanks for tutorial :)

Super moderator

Keep Calm and Use Mi !

Rank: 8Rank: 8

Credits
122806
Device
Redmi Note 5/Pro
Online time
1524 Hours
Send PM

Unlock MedalMijia Story TellerMi VR HeadsetMi In-Ear HeadphonesMi HomeMi Bluetooth HeadsetMagic CubeMijia Electric ScooterMi VRXiaomi 6 LaunchMi WiFi Router MiniMi Band 2Mi  BunnyMi USB FanMi Power BankMi HeadphonesMi Power StripMi WiFi RouterMi Bluetooth Canon SpeakerMi Power Bank 10000MAH Mi BandXiaomi 7th AnniversaryMIUI Devices ContestAnTuTuI Love MIUIAwesome!MIUI 6MIUI 8MarshmallowMIUI 2015Fantastic!MIUI 7MIUI 2016FlashholicMi PadXiaomi Mi 4Redmi NoteRedmi 1SMi Note ProRedmi 3SRedmi Note 4Mi 3Mi TVRedmi 3Mi 5Redmi 2Redmi Note 3Redmi 4/Prime/4AMi 4cMi 4iRedmi Note 24 Million Forum MembersMIUI Fan From SingaporeMIUI Fan from MalaysiaMIUI Fan from TurkeyMIUI Drawing TalentSuper FridayMIUI 2017Hilal Ramadan MIUI Fan From PhilippinesSuper Tuesday2100K Forum MembersFan Of MIUI Greece1 Million Forum App InstallsMIUI Weekly PollMIUI Fan From BrazilMIUI Fan From IndonesiaMIUI Fan from IndiaRooster Year of 2017Fan Of MIUI IndiaI Love 2016Rocket to Future2014 Christmas900K Forum Members800K Forum Members700K Forum MembersMIUI 5th AnniversaryMerry ChristmasFan of MIUI MyanmarMIUI Monthly TalkXiaomi 6th Anniversary1 Million Forum MembersMalaysia Anniversary600K Forum MembersFan Of MIUI BangladeshThanksgiving DayDiwali Happy DiwaliHappy Valentine's DayHappy New YearXiaomi 5th Anniversary500K Forum MembersMIUI 100 Million UsersMid-Autumn FestivalFan Of MIUI Italy1900K Forum MembersSurge S1Women's Day MedalPopular Thread Of 2015MIUI 9Ringolicious MedalMIUI PMIUI SSingapore Merlion MedalSuper Wednesday3500K Forum MembersMIUI 7th Anniversary3 Million Forum App InstallsSuper SundayMIUI Happy Medal10 Million Forum Posts3 Million Forum MembersSuper MondayHappy Holi Medal5 Million Forum App InstallsMIUI Lucky FridayMIUI 300 WeeksOlympics Medal1800K Forum MembersMIUI Marathon MedalFan Of MIUI RussiaFan Of MIUI SpainMIUI World TourMIUI Forum AppMIUI 6th AnniversaryMIUI Fan From Nepal5 Million Forum Posts1300K Forum MembersUEFA EURO Medal1400K Forum Members1500K Forum MembersPokemon Master MedalMIUI Fan From MyanmarPuzzle MasterSummer Mi BunnyMiPopGamer Mi BunnyAlpaca Mi Bunny I Love Mi BunnyMIUI Device TeamMIUI News TeamMIUI Beta TeamMIUI Beta team - IndiaMIUI Halloween 2017Gold Super ModeratorXiaomi Type-C EarphonesMIUI 8th AnniversaryDiamond Super Moderator13 Million Forum MembersXiaomi 8th AnniversaryRedmi Note 5/Pro7 Million Forum Members6 Million Forum Members8 Million Forum Members2017 Annual AwardsMi Bunny Game Master Updates LoverYouth PledgeInbox ZeroDebate MasterHumor MasterMIUI Android 4.4 KitKatAndroid GuruScroll Of WisdomForum Contest LoverMi TalentMi Story TellerAndroid ElfMIUI FB FollowerMIUI Twitter FollowerMIUI G+ FollowerMr. DependableMIUI FollowerSuper ModeratorJuly 19 MyanmarPioneer of MIUI English Forum Ringtone Star Die-hard MIUI FanMi Lover MedalStar Of TechnologyMaster Of TechnologyApp TalentMIUI Medals CollectorMIUI KingApp StarTechnology GuruStar Of IconsOTA Feedback

20:03, Jan-13-2017 | From PC
|
Thanks for sharing this useful article.
Cheers!


Click [Reply] so that i can get a notification!
Use Search Option before posting!

Elite Member

Because IM BATMAAAAN!!!!

Rank: 6Rank: 6

Credits
9824
Device
Redmi Note 3
Online time
392 Hours
Send PM

Mi HomeYi Action CameraUnlock MedalMi HeadphonesMi Band 2Mi Bluetooth SpeakerMi Power Bank 10000MAH Mi VR HeadsetMijia Qi CycleMi BandMi  BunnyYeelight Bedside LampXiaomi 7th AnniversaryMIUI 2016I Love MIUIMIUI 8Awesome!Fantastic!MIUI 7MarshmallowAnTuTuMi TVRedmi Note 34 Million Forum MembersOlympics MedalSuper Thursday3 Million Forum MembersMIUI Fan From NepalMIUI Lucky FridayMIUI Happy Medal1500K Forum MembersMIUI Forum AppMi Live MedalMid-Autumn FestivalMIUI Fan from IndiaFan Of MIUI India300K Forum Members1900K Forum MembersUEFA EURO Medal100k Forum MembersMIUI Fan from MalaysiaPokemon Master MedalMIUI 6th Anniversary1400K Forum MembersSuper SaturdaySuper FridayMIUI 300 Weeks2100K Forum Members1 Million Forum App InstallsXiaomi 6th AnniversaryHappy New YearRooster Year of 2017Rocket to FutureMerry ChristmasThanksgiving DayI Love 2016Super MondayMIUI 2017MIUI World Tour1800K Forum MembersSurge S1Happy DiwaliFan Of MIUI Bangladesh10 Million Forum PostsI Love Mi BunnyMiPopGamer Mi BunnySummer Mi BunnyMIUI Device TeamPioneer of MIUI English Forum MIUI FollowerMIUI ExpertYouth PledgeAndroid GuruUpdates LoverScroll Of WisdomMi Lover MedalTechnology GuruMIUI Ice Bucket ChallengeMIUI Medals CollectorInbox ZeroRingtone Star Star Of TechnologyMIUI Device ExpertApp TalentForum Contest LoverDebate MasterDie-hard MIUI FanApp TalentAndroid ElfMIUI KingMi TalentMi Story Teller

20:10, Jan-13-2017 | From PC
|
Well Explained and detailed article
Always use Reply option so we can be notified

Supreme Member

RAHUL NAIK

Rank: 7Rank: 7Rank: 7

Credits
134647
Device
Redmi Note 5/Pro
Online time
341 Hours
Send PM

Mi  BunnyMi Bluetooth SpeakerYeelight Bedside LampMi KeyMi BandMi VRUnlock MedalMi Band 2Mi HomeXiaomi 7th AnniversaryMIUI 7MarshmallowFlashholicI Love MIUIFantastic!MIUI 2016MIUI 8MIUI Devices ContestAnTuTuAwesome!Mi TVRedmi Note 3MIUI 6th AnniversaryOlympics MedalFan Of MIUI BangladeshUEFA EURO MedalMIUI Fan From IndonesiaHilal Ramadan MIUI Fan From MyanmarMIUI 300 WeeksMIUI Fan from MalaysiaMIUI Fan From VietnamFan Of MIUI IndiaMIUI Fan From BrazilMalaysia Anniversary2100K Forum Members1500K Forum MembersMIUI Weekly PollMIUI World TourI Love 2016Rooster Year of 2017Happy New YearRocket to FutureSuper SundayFan Of MIUI Russia1800K Forum MembersMIUI Forum App1400K Forum Members1700K Forum MembersI Love Mi BunnyGamer Mi BunnySummer Mi BunnyMiPopMIUI Beta TeamUpdates LoverDebate MasterMIUI FB FollowerMr. Dependable2017 Annual AwardsMIUI ExpertMi Bunny Game Master MIUI Medals CollectorRingtone Star Mi TalentMi Story TellerDie-hard MIUI FanTechnology GuruForum Contest LoverStar Of TechnologyMIUI FollowerAndroid GuruMi Lover MedalAndroid ElfYouth Pledge

20:11, Jan-13-2017 | From PC
|
Thnx for sharing......

Diamond Member

Rank: 5Rank: 5

Credits
1817
Device
Redmi 4 Prime
Online time
118 Hours
Send PM

Mi HomeMi HeadphonesMi BandUnlock MedalMi Band 2Magic CubeFantastic!MarshmallowMi 4cRedmi 4/Prime/4ARocket to FutureMIUI 9MIUI Fan From IndonesiaMIUI Forum AppSurge S1Debate MasterBlack Shark

20:28, Jan-13-2017 | From PC
|
This post was edited by mirulumam at 19:30, Jan-13-2017

additional,
when you type adb devices command then return 384987bd75e7k unauthorized status, please check your phone to permit the computer access the phone via adb. usually, phone prompts adb authorization dialog, then check adb device again

Comment

Raaj52 Thanks!  20:37, Jan-13-2017

Platinum Member

i hope hell has wifi.

Rank: 4

Credits
2824
Device
Redmi 4A
Online time
135 Hours
Send PM

Yi Action CameraMi WiFiMagic CubeMi VR HeadsetMi Band 2Mi Power Bank 10000MAH Mijia Mi Bunny RobotMi Selfie StickMi HeadphonesMi HomeI Love MIUIFantastic!MIUI 2016MIUI 8MIUI Devices ContestHappy Valentine's DayFan Of MIUI BulgariaCamera Filter Guru MedalMIUI Fan from MalaysiaMIUI World TourRooster Year of 2017MIUI 2017Happy New Year3 Million Forum App InstallsMIUI Lucky FridayMIUI Fan from IndiaMIUI Drawing TalentFan Of MIUI IndiaFan Of MIUI BangladeshFan Of MIUI FranceSuper WednesdayWomen's Day Medal10 Million Forum Posts3 Million Forum MembersSurge S1Rocket to FutureSuper ThursdayPuzzle MasterFan Of MIUI RussiaHappy Holi MedalSuper FridaySingapore Merlion MedalSuper MondayGamer Mi BunnyRingtone Star Debate MasterYouth PledgeStar Of TechnologyDie-hard MIUI FanForum Contest LoverMaster Of TechnologyMi Story TellerMIUI ExpertAndroid ElfTechnology GuruScroll Of WisdomAndroid GuruMi Lover MedalMIUI Ice Bucket Challenge

20:37, Jan-13-2017 | From PC
|
Thanks for the useful information

Senior Member

Rank: 2

Credits
84
Device
Redmi 4 Prime
Online time
1 Hours
Send PM

3 Million Forum App InstallsMIUI Drawing TalentMIUI Fan from Malaysia

20:48, Jan-13-2017 | Via mobile
|
Thanks

Supreme Member

Wake,Work,Sleep All With Forum

Rank: 7Rank: 7Rank: 7

Credits
39804
Device
Redmi 3S Prime
Online time
593 Hours
Send PM

Mi VRXiaomi 6 LaunchMijia Qi CycleMi HomeMi Selfie StickMi VR HeadsetMi Power Bank 10000MAH Mijia VR Play 2Mi Bluetooth SpeakerMagic CubeMi Plastic In-ear PhonesMi HeadphonesMi Bluetooth HeadsetMi Kids WatchMijia Electric ScooterXiaomi 7th AnniversaryAwesome!I Love MIUIMIUI Devices ContestFantastic!MIUI 8MarshmallowMIUI 2016Redmi 3S4 Million Forum MembersMIUI Forum App1 Million Forum App InstallsSuper WednesdayFan Of MIUI BangladeshMi Live MedalSurge S1Women's Day MedalSuper FridayI Love 2016Puzzle MasterRooster Year of 2017MIUI Weekly PollHappy Valentine's Day3 Million Forum MembersFan Of MIUI IndiaMIUI Lucky FridayMIUI Fan from IndiaMIUI Drawing TalentSuper TuesdayHappy New YearSuper Monday3 Million Forum App InstallsMIUI 201710 Million Forum Posts90000 Forum MembersMIUI 9MIUI Happy MedalAtaturk MourningHilal Ramadan MIUI Font LoverCamera Filter Guru MedalMIUI P300K Forum Members3500K Forum MembersFan Of MIUI RussiaMIUI World TourMIUI 100 Million UsersMIUI 7th AnniversarySuper ThursdaySuper Sunday500K Forum MembersRocket to FutureMiPopGamer Mi BunnyI Love Mi BunnyMIUI Device TeamMi Bunny Game Master Ringtone ExpertMi TalentStar WarsXiaomi 8th AnniversaryMIUI 8th AnniversaryMIUI Weekly Devices QuizMi Lover MedalForum Contest LoverMIUI Android 4.4 KitKat2017 Annual AwardsMIUI Halloween 2017Scroll Of WisdomMIUI SuperstarMost Popular Forum UserAndroid ElfMaster Of TechnologyMi Story Teller7 Million Forum MembersUpdates LoverMIUI ExpertTechnology GuruPioneer of MIUI English Forum MIUI Ice Bucket ChallengeDebate MasterDie-hard MIUI FanMIUI Medals CollectorMost Active MIUIerAndroid GuruMIUI FollowerTheme TalentStar Of Technology

21:13, Jan-13-2017 | Via mobile
|
Well explained

Credits Management

Quick Reply Top Return to the list