Last active
March 29, 2022 16:19
-
-
Save r4dixx/237c703106061a6d8c1c625b0687f162 to your computer and use it in GitHub Desktop.
Minimal Android setup. Useful for basic testing or demo setups
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
#!/bin/sh | |
# Install Homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
# Install Java, Android command line tools and scrcpy | |
brew install openjdk@11 | |
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk | |
brew install android-commandlinetools | |
brew install scrcpy | |
# Setup environment variables | |
echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> ~/.zprofile | |
echo 'export ANDROID_SDK_ROOT=/opt/homebrew/share/android-commandlinetools/' >> ~/.zprofile | |
echo 'export PATH=$PATH:$ANDROID_SDK_ROOT/emulator' >> ~/.zprofile | |
echo 'export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools' >> ~/.zprofile | |
# Setup Android SDK and Android Emulator | |
sdkmanager "build-tools;32.0.0" "platform-tools" "emulator" "system-images;android-32;google_apis_playstore;arm64-v8a" "platforms;android-32" | |
echo "no" | avdmanager create avd -n "Pixel_4a_Android_12L" -d "pixel_4a" -k "system-images;android-32;google_apis_playstore;arm64-v8a" | |
# Add desktop shortcuts | |
printf '%s\n' '#!/bin/sh' 'scrcpy --show-touches; exit' > ~/Desktop/broadcast-phone.sh | |
chmod +x ~/Desktop/broadcast-phone.sh | |
printf '%s\n' '#!/bin/sh' 'emulator -avd Pixel_4a_Android_12L; exit' > ~/Desktop/launch-emulator.sh | |
chmod +x ~/Desktop/launch-emulator.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment