Forked from harshmandan/Install android sdk on command line or terminal on Ubuntu 18.04 or 20.04
Last active
April 28, 2023 02:26
-
-
Save ashbeats/9d837cdc875294e0ed96d2cf2cddc228 to your computer and use it in GitHub Desktop.
Follow these instruction to install Android SDK on a AWS EC2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Export the path to enviroment | |
export ANDROID_HOME=/home/ec2-user/environment/android-sdk | |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/platform-tools | |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/tools/bin | |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is going to be our sdk installation directory | |
cd /home/ec2-user/environment/ | |
#Install JDK first | |
pkg install openjdk-8-jdk | |
#Some utilities | |
pkg install unzip | |
pkg install git | |
#Install latest command line tools. Visit https://developer.android.com/studio/command-line for latest version. Use that link. | |
wget https://dl.google.com/android/repository/commandlinetools-linux-6514223_latest.zip | |
#Extract the downloaded zip | |
unzip commandlinetools-linux-6514223_latest.zip | |
# Set-up directory-structure for the sdk | |
mkdir android-sdk | |
mv tools android-sdk/ | |
# Remove downloaded zip file | |
rm commandlinetools-*.zip | |
# Set-up the directory structure some more | |
cd android-sdk/ | |
mkdir cmdline-tools | |
mv tools cmdline-tools/ | |
# Export the path to enviroment | |
export ANDROID_HOME=/home/ec2-user/environment/android-sdk | |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/platform-tools | |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/tools/bin | |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools | |
# That's it! You have succesfully installed the Android SDK/Build tools via command line | |
# Follow along to set-up sdks so that you can start building | |
# You can use this command to see the list of available SDKs/NDKs/tools. | |
./sdkmanager --list | |
# Run this command. The versions may change in the future. You'll also need to accept TnC. (Very important!) | |
./sdkmanager "patcher;v4" "build-tools;29.0.2" "platforms;android-29" "platform-tools" | |
# Return back to home | |
cd /home/ec2-user/environment | |
# Clone your favorite Android app's repository | |
git clone https://github.com/harshmandan/sample-android.git | |
cd sample-android/ | |
# You may need to give execution permission to the gradlew file | |
sudo chmod +x gradlew | |
# Now you can start buidling! YAY! | |
./gradlew assemble | |
# Congratulations! You can now build you apps without any GUI/Android Studio. | |
# Bonus (for people who are new to *nix) | |
# When running long jobs on a VPS you may want to leave the terminal to do other things or just disconnect. | |
# You can use screen tool to do just that. | |
sudo apt-get install screen | |
# Screen let you create a virtual terminal or a secondary terminal where you can keep do stuff in background. | |
# Here's a very quick and solid guide to screen: https://www.youtube.com/watch?v=3txYaF_IVZQ | |
##### fin. #################################### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment