Android
Android is an operating system developed by the Open Handset Alliance, led by Google, and mainly used on smartphones, tablets and multimedia boxes. It mainly runs on the ARM 6 and 7 architecture, but it has also been ported to x86 and MIPS. It uses the Linux kernel with a custom userland which is Apache licensed.
Gentoo has some Android-specific packages:
- app-mobilephone/heimdall
- app-mobilephone/scrcpy
- app-mobilephone/qtadb
- dev-util/android-ndk
- dev-util/android-sdk-update-manager
- dev-util/android-studio
- dev-util/android-tools
- sys-fs/android-file-transfer-linux
Setting up an Android dev environment without Android Studio
To set up a development environment for Android without installing Android Studio (e.g. because you'd prefer to use app-editors/vim or app-editors/emacs for development):
- Ensure none of the packages listed at the start of this page are installed, in order to avoid duplicate installations and potential conflicts.
- Install the dev-java/openjdk-bin or dev-java/openjdk package:
root #
emerge openjdk-bin
- Install the app-eselect/eselect-java package:
root #
emerge app-eselect/eselect-java
and select the appropriate Java VM as the user under which you'll be doing development:
user $
eselect java-vm list
Available Java Virtual Machines: [1] openjdk-bin-8 [2] openjdk-bin-17
user $
eselect java-vm set user openjdk-bin-17
- Install the acct-group/android package:
root #
emerge acct-group/android
- Add that user to the
android
group:
root #
gpasswd -a <USER> android
- Create a directory for the Android SDK, e.g. ~/android:
user $
mkdir ~/android
- Download the latest version of the Android platform-tools for Linux from https://developer.android.com/tools/releases/platform-tools and unpack them in the SDK directory:
user $
unzip -d ~/android/ platform-tools_r34.0.5-linux.zip
- Download the latest version of Android cmdline-tools for Linux from https://developer.android.com/studio#command-line-tools-only and unpack them in the SDK directory:
user $
unzip -d ~/android/ commandlinetools-linux-11076708_latest.zip
- Configure the relevant path environment variables for your shell (e.g. in ~/.bash_profile):
export ANDROID_HOME="${HOME}/android"
export PATH="${PATH}:${ANDROID_HOME}/platform-tools";
export PATH="${PATH}:${ANDROID_HOME}/cmdline-tools/bin";
Apply the group and environment changes by logging the dev user out of any existing sessions, then logging that user back in again.
- Use sdkamanager to list available platform SDK versions, and install the latest platform:
user $
sdkmanager --sdk_root=~/android --list
user $
sdkmanager --sdk_root=~/android --install "platforms;android-34"
- Install the appropriate version of Android build-tools for that platform, and refresh cmdline-tools:
user $
sdkmanager --sdk_root=~/android --install "build-tools;34.0.0"
user $
sdkmanager --sdk_root=~/android --install "cmdline-tools;latest"
- Review and accept the relevant licenses:
user $
sdkmanager --sdk_root=~/android --licenses
Detailed information about environment variables affecting the Android SDK can be found at https://developer.android.com/tools/variables.
See also
- Android/Devices — a list of mobile devices tested via the stage3 tarball provided by the Android project.
- Android USB tethering — the sharing of a mobile device's Internet connection with other connected computers.
- mksh — an actively developed free implementation of the Korn Shell programming language and a successor to the Public Domain Korn Shell
- Android/adb — Android Debug Bridge
- Android/Fastboot - Android Bootloader
- app-emulation/genymotion-bin - old forum post about using Genymotion from other overlays. The main package repo is more up to date.
- Note: genymotion will require an external account to be made with the company to use the emulator
- Android/SharkBait — A project to create a recognizable identity and foster development of Portage-powered Android.