Last active
January 14, 2020 21:19
-
-
Save reline/9fe69456b40cb228197a83384ef46026 to your computer and use it in GitHub Desktop.
Ultimate Android build system dependency script (Ubuntu 14.04)
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
apt-get update | |
apt-get install -y software-properties-common | |
echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections | |
echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections | |
add-apt-repository -y ppa:webupd8team/java | |
dpkg --add-architecture i386 | |
apt-get update | |
apt-get install -y --force-yes apt-utils build-essential git unzip oracle-java8-installer python libreadline-dev curl bzip2 libssl-dev zlib1g-dev libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 | |
apt-get -fy install | |
git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv | |
git clone https://github.com/rbenv/ruby-build.git $HOME/.rbenv/plugins/ruby-build | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash | |
rbenv install 2.4.2 | |
rbenv global 2.4.2 | |
gem install bundler | |
gem install fastlane -NV | |
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip | |
unzip sdk-tools-linux-*.zip -d $HOME/android-sdk-linux | |
export PATH="$HOME/android-sdk-linux/tools:$PATH" | |
export PATH="$HOME/android-sdk-linux/tools/bin:$PATH" | |
yes | sdkmanager --licenses | |
sdkmanager "platform-tools" "tools" "emulator" | |
for i in `seq 26`; do sdkmanager "platforms;android-$i"; done |
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
import subprocess | |
output = subprocess.check_output(['adb', 'devices']) | |
lines = output.splitlines() | |
lines.pop(0) | |
lines.pop() | |
if len(lines) != 0: | |
print(output) | |
print('Killing devices: ') | |
for line in lines: | |
device = line.split('\t')[0] | |
print(device) | |
print(subprocess.check_output(['adb', '-s', device, 'emu', 'kill'])) | |
else: | |
print('No devices attached') |
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
echo "Accepting SDK package licenses..." | |
yes | sdkmanager --licenses | |
echo "Creating emulator..." | |
sdkmanager "system-images;android-19;google_apis;x86" | |
echo no | avdmanager create avd --force --name test --package "system-images;android-19;google_apis;x86" | |
echo | |
echo "Created emulator" |
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
Process.fork { `$(which emulator) -avd test -no-audio -no-window` } |
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
./setup_emulator.sh | |
python kill_devices.py # just in case, kill all connected devices | |
ruby start_emulator.rb | |
adb wait-for-device | |
gradle test | |
gradle connectedAndroidTest | |
python kill_devices.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment