Android Studio
- Android SDK to debug and useful commands about Android
- Emulators to run your application without any Android smartphone
- developer.android.com/studio website of Android Studio
- doc.ubuntu-fr.org/android_sdk documentation about Linux installation
Installation
On Ubuntu with PPA
Android Studio is not available with APT but on Ubuntu we can add a PPA to add it to APT.
sudo apt-add-repository ppa:maarten-fonville/android-studio
sudo apt install -y android-studio
On another distribution
You have two choices, you can download directly archive on official website or with terminal and wget. If you choose this method, this is an example with a version of Android Studio (september 2020), if you want a recent version, check on official website if you can find most recent Android Studio - you can update link and download it with terminal.
wget -O android-studio.tar.gz "https://redirector.gvt1.com/edgedl/android/studio/ide-zips/4.0.1.0/android-studio-ide-193.6626763-linux.tar.gz"
Move archive to /opt
and extract it
sudo mv android-studio*.tar.gz /opt
sudo tar xf /opt/android-studio*.tar.gz
Create an application launcher
vim ~/.local/share/applications/android-studio.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Android Studio
Exec=/opt/android-studio/bin/studio.sh
# Before v6.1.2
# Icon=/opt/Postman/resources/app/assets/icon.png
Icon=/opt/android-studio/bin/studio.png
Terminal=false
Type=Application
Categories=Development;
Platform-tools
~/Android/SdK/tools
and ~/Android/SdK/platform-tools
are installed when Android Studio is installed and setup. It's tools to work with Android, it's very useful to debug.
In .profile
, .bashrc
or .zshrc
export PATH=${PATH}:/home/ewilan/Android/Sdk/tools
export PATH=${PATH}:/home/ewilan/Android/Sdk/tools:/home/ewilan/Android/Sdk/platform-tools
And check if you have adb
command
adb devices
source ~/.zshrc
Virtual device
developer.android.com/emulator-acceleration: Configure VM acceleration on Linux
Open AVD Manager from toolbar or search avd
in global search (double tape on N).
Create new device, select phone with PlayStore, like Pixel 2 and select recent Android OS, like Oreo 8.1
. Download image to create virtual device and launch it. If you have some problems with KVM
check below.
AVD Manager without Android Studio
List availables emulator devices
~/Android/Sdk/tools/emulator -list-avds
Start an emulator where Pixel_2
is emulator's name
~/Android/Sdk/tools/emulator -avd Pixel_2
Troubles with KVM
If you have this error in AVD Manager
/dev/kvm permission denied
Setup KVM with this
sudo apt install qemu-kvm
ls -al /dev/kvm\n
grep kvm /etc/group\n
sudo adduser $USER kvm
Restart / Logout
If nothing work:
sudo chown $USER /dev/kvm