I just installed Android Studio. How do I get into root shell on my phone? Or do I have to download ADB separately?


Android Studio does not contain ADB, you need Android SDK for it (it is installed on first run of Android Studio 0.9.x and newer). ADB is located in sdk\platform-tools.

It's possible to add to PATH in Windows and use Terminal inside Android Studio only by command: adb shell and after use su get root shell.

  1. Locate the SDK platform tools folder (e.g. C:\android\sdk\platform-tools)
  2. Open Enviroment Variables in Windows (See http://www.computerhope.com/issues/ch000549.htm)
  3. Append the platform tools path (e.g. C:\android\sdk\platform-tools) to the PATH variable
  4. Reopen Android Studio
  5. Use Terminal with adb shell

Older Windows will maybe need to reboot after changing the PATH variables.

On newer Android Studio versions, the Android SDK is copied on a folder outside the Android Studio folder; it is downloaded after the first time you run Android Studio. For more information, see Android Studio 0.8.14 in Beta Channel.

  • I just installed Android Studio on Windows and there is no .\sdk folder in C:\Programs\Android Studio...
    – daaxix
    Jan 1 '15 at 6:39
  • 1
    From new Android Studio is Android SDK separate outside Android Studio folder and is downloaded after first run of Android Studio. For more info: tools.android.com/recent/androidstudio0814inbetachannel
    – mtrakal
    Jan 5 '15 at 11:06
  • 1
    Actually, it was installed in userspace (user directory) instead, I haven't used ADB in awhile...
    – daaxix
    Jan 5 '15 at 19:15
  • 17
    On Windows, running Android Studio 1.5.x, it installed to this path for me: C:\Users\<user>\AppData\Local\Android\sdk\platform-tools\adb.exe
    – Joel B
    Jan 18 '16 at 1:26
  • 1
    This answer is out of date. Please edit it or downvote it. The answer by B.Rossow is correct. Mar 18 '19 at 19:18

WINDOWS: In the current version of Android Studio, ADB.exe is located in %USERPROFILE%\AppData\Local\Android\sdk\platform-tools\. Earlier versions of Android Studio have it in %LOCALDATA%\Android\sdk\platform-tools instead.

MAC: Find the ADB executable in ~/Library/Android/sdk/platform-tools.

  • 3
    ....helpful, good input. +1
    – HasH_BrowN
    Jan 6 '15 at 17:46
  • 1
    The accepted answer didn't help with finding where ADB is installed. Newer versions install it on a per-user directory.
    – apaderno
    Nov 18 '17 at 19:30
  • I expanded my original answer to include current and historic paths and multiple platforms. :)
    – B.Rossow
    Jan 8 '18 at 16:22

On a Mac Android Studio installs adb there:

/Users/<your username>/Library/Android/sdk/platform-tools

To use it in your shell, you can add it to your .profile file:

export PATH=/Users/<your username>/Library/Android/sdk/platform-tools:$PATH

Please open a fresh terminal window after you did that, or load the changes by typing this in your terminal:

source ~/.profile
  • Great job on the formatting you've done. Stack Exchange, however, does not support the standard triple backtick ... code block notation, but instead uses an indentation of 4 spaces for code blocks.
    – iBug
    Nov 21 '17 at 11:16

Once you have Android Studio set up make sure you can connect to an emulator or a device where it will be listed in the AVD (Android Virtual Devices). If a physical device is connected confirm that debugging mode is enabled and access is allowed to Android Studio. A separate ADB is not needed as all the build tools are part of the IDE.

Now you are ready to access your device's shell!

  1. Access the terminal at the bottom of the IDE by selecting the Terminal button.

  2. In the terminal issue adb devices. This will list the all devices currently connected to Android Studio. Find and use your device's name for step 3.

  3. Now issue adb -s <device-name> shell. Now you are in your device's shell.

On a side note, if you want to access the shell of an emulator with root access installed from Android Studio, issue a adb -s <device-name> root before accessing the shell.

  • After "adb -s <device-name> root" how to exit then get in again with non-root user? Getting in again with shell the user is still root.
    – jw_
    Oct 22 '19 at 4:44
  • 1
    @jw_ adb -s <device-name> unroot :)
    – NocTurn
    Oct 22 '19 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.