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
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.
- Locate the SDK platform tools folder (e.g. C:\android\sdk\platform-tools)
- Open Enviroment Variables in Windows (See http://www.computerhope.com/issues/ch000549.htm)
- Append the platform tools path (e.g. C:\android\sdk\platform-tools) to the PATH variable
- Reopen Android Studio
- Use Terminal with
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.
On a Mac Android Studio installs adb there:
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:
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!
Access the terminal at the bottom of the IDE by selecting the Terminal button.
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.
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.