Forked from atyachin/Android-Emulator-on-AWS-EC2.txt
Last active
December 15, 2019 21:07
-
-
Save dimitrovs/f3c0e9f697c982e92ae83297c6d40294 to your computer and use it in GitHub Desktop.
Installing and running Android Emulator on Amazon AWS EC2 (Ubuntu 16.04 / m5.xlarge)
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
Steps for installing the Android Emulator from EC2 console: | |
----------------------------------------------------------- | |
sudo apt install default-jdk unzip | |
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
unzip sdk-tools-linux-4333796.zip -d android-sdk | |
sudo mv android-sdk /opt/ | |
export ANDROID_SDK_ROOT=/opt/android-sdk | |
echo "export ANDROID_SDK_ROOT=/opt/android-sdk" >> ~/.bashrc | |
echo "export PATH=$PATH:$ANDROID_SDK_ROOT/tools" >> ~/.bashrc | |
. .bashrc | |
cd /opt/android-sdk/tools/bin | |
/opt/android-sdk/tools/bin/sdkmanager --update | |
/opt/android-sdk/tools/bin/sdkmanager --licenses | |
/opt/android-sdk/tools/bin/sdkmanager "system-images;android-25;google_apis;armeabi-v7a" | |
/opt/android-sdk/tools/bin/sdkmanager "emulator" | |
/opt/android-sdk/tools/bin/sdkmanager "platform-tools" | |
touch /home/ubuntu/.android/repositories.cfg | |
mkdir /opt/android-sdk/platforms | |
/opt/android-sdk/tools/bin/avdmanager -v create avd -f -n MyAVD -k "system-images;android-25;google_apis;armeabi-v7a" -p "/opt/android-sdk/avd" | |
Optional: eanbling/disabling certain HW features | |
------------------------------------------------- | |
echo "hw.audioInput=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.audioOutput=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.cpu.ncore=2" >> /opt/android-sdk/avd/config.ini | |
echo "hw.camera.back=none" >> /opt/android-sdk/avd/config.ini | |
echo "hw.camera.front=none" >> /opt/android-sdk/avd/config.ini | |
echo "hw.gsmModem=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.gps=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.accelerometer=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.battery=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.trackBall=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.dPad=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.sensors.proximity=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.sensors.magnetic_field=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.sensors.orientation=no" >> /opt/android-sdk/avd/config.ini | |
echo "hw.sensors.temperature=no" >> /opt/android-sdk/avd/config.ini | |
Running the Emulator: | |
--------------------- | |
/opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -no-window -no-audio -gpu swiftshader_indirect -show-kernel | |
Fixing 100% CPU: Disabling the "Ok Google" Hotword detection: | |
------------------------------------------------------------- | |
./adb shell "su root pm disable com.google.android.googlequicksearchbox" | |
Note: run after Emulator loaded | |
Notes: | |
------ | |
1. We run ARM emulation on x86 instance. | |
2. We must use ARM ABI, since x86 requires KVM and EC2 instance doesn't support HW virtualization. | |
3. We must disable GUI (-no-window) and audio (-no-audio) when running the emulator. | |
4. We must specify "-gpu swiftshader_indirect" when running the emulator to prevent a boot loop. | |
5. First startup takes VERY LONG time. Use "-show-kernel" to see kernel messages and in secondary console window use "/opt/android-sdk/platform-tools/adb logcat" to see the system log while the emulator starts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment