Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yazinsai/652f0e6e77c9594a2356dd6314a9c3d8 to your computer and use it in GitHub Desktop.
Save yazinsai/652f0e6e77c9594a2356dd6314a9c3d8 to your computer and use it in GitHub Desktop.

Revisions

  1. yazinsai revised this gist Jul 31, 2019. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -14,12 +14,10 @@ source ~/.bashrc
    cd /opt/android-sdk/tools/bin
    ./sdkmanager --update
    ./sdkmanager --licenses
    ./sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
    ./sdkmanager "emulator"
    ./sdkmanager "platform-tools"
    ./sdkmanager "system-images;android-25;google_apis;armeabi-v7a" "emulator" "platform-tools"
    touch ~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"
    /opt/android-sdk/tools/bin/avdmanager -v create avd -f -n MyAVD -k "system-images;android-27;google_apis;armeabi-v7a" -p "/opt/android-sdk/avd"
    ```

    # Install VNC
    @@ -56,7 +54,7 @@ Now run this command inside the terminal on your VNC client:

    ```
    # @ your VNC terminal
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel -skin 768x1280
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel
    ```

    Note: I added `-skin 768x1280` to fix the resolution issue I was facing.
    @@ -79,6 +77,7 @@ 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
    echo "hw.ramSize=4096" >> /opt/android-sdk/avd/config.ini
    ```

    ### Notes
    @@ -98,6 +97,6 @@ echo "hw.sensors.temperature=no" >> /opt/android-sdk/avd/config.ini
    ### Creating another AVD

    ```
    /opt/android-sdk/tools/bin/avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;armeabi-v7a" -c 2000M --tag "google_apis" --device "Nexus 5X"
    /opt/android-sdk/tools/bin/avdmanager create avd -n TestEmulator1 -k "system-images;android-27;google_apis;armeabi-v7a" -c 2000M --tag "google_apis" --device "Nexus 5X"
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd TestEmulator1 -gpu swiftshader_indirect -show-kernel -skin "1080x1920" -wipe-data
    ```
  2. yazinsai revised this gist Jul 31, 2019. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    # Steps for installing the Android Emulator from EC2 console:
    # Getting the Android Emulator running on EC2 📱

    ```bash
    # @ your EC2 instance
    sudo apt update
    sudo apt install openjdk-8-jre unzip
    wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
    @@ -24,6 +25,7 @@ mkdir /opt/android-sdk/platforms
    # Install VNC

    ```bash
    # @ your EC2 instance
    sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal xfce4 vnc4server
    vncserver
    vncserver -geometry 1600x900
    @@ -46,12 +48,14 @@ See [this article](https://medium.com/@Arafat./graphical-user-interface-using-vn
    Setup local port forwarding to allow your VNC client to connect to the server:

    ```
    # @ your local machine
    ssh -L 5902:localhost:5902 emulator-aws
    ```

    Now run this command inside the terminal on your VNC client:

    ```
    # @ your VNC terminal
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel -skin 768x1280
    ```

  3. yazinsai revised this gist Jul 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ echo "hw.sensors.temperature=no" >> /opt/android-sdk/avd/config.ini

    ```
    /opt/android-sdk/tools/bin/avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;armeabi-v7a" -c 2000M --tag "google_apis" --device "Nexus 5X"
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd TestEmulator1 -gpu swiftshader_indirect -show-kernel -skin "1920x1080"
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd TestEmulator1 -gpu swiftshader_indirect -show-kernel -skin "1080x1920" -wipe-data
    ```
  4. yazinsai revised this gist Jul 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ echo "hw.sensors.temperature=no" >> /opt/android-sdk/avd/config.ini

    ```
    /opt/android-sdk/tools/bin/avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;armeabi-v7a" -c 2000M --tag "google_apis" --device "Nexus 5X"
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd TestEmulator1 -gpu swiftshader_indirect -show-kernel -skin "1440x2560"
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd TestEmulator1 -gpu swiftshader_indirect -show-kernel -skin "1920x1080"
    ```
  5. yazinsai revised this gist Jul 31, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -90,3 +90,10 @@ echo "hw.sensors.temperature=no" >> /opt/android-sdk/avd/config.ini
    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.

    ### Creating another AVD

    ```
    /opt/android-sdk/tools/bin/avdmanager create avd -n TestEmulator1 -k "system-images;android-25;google_apis;armeabi-v7a" -c 2000M --tag "google_apis" --device "Nexus 5X"
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd TestEmulator1 -gpu swiftshader_indirect -show-kernel -skin "1440x2560"
    ```
  6. yazinsai revised this gist Jul 31, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -52,9 +52,11 @@ ssh -L 5902:localhost:5902 emulator-aws
    Now run this command inside the terminal on your VNC client:

    ```
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel -skin 768x1280
    ```

    Note: I added `-skin 768x1280` to fix the resolution issue I was facing.

    ### Optional: enabling/disabling certain HW features

    ```
  7. yazinsai revised this gist Jul 31, 2019. 1 changed file with 18 additions and 12 deletions.
    30 changes: 18 additions & 12 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -39,9 +39,23 @@ unset DBUS_SESSION_BUS_ADDRESS
    startxfce4 &
    ```

    See [https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5](https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5)
    See [this article](https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5) for more details on VNC setup

    # Optional: enabling/disabling certain HW features
    # Running the Emulator (on VNC):

    Setup local port forwarding to allow your VNC client to connect to the server:

    ```
    ssh -L 5902:localhost:5902 emulator-aws
    ```

    Now run this command inside the terminal on your VNC client:

    ```
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel
    ```

    ### Optional: enabling/disabling certain HW features

    ```
    echo "hw.audioInput=no" >> /opt/android-sdk/avd/config.ini
    @@ -61,22 +75,14 @@ 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 (on VNC):
    ### Notes

    ```
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel
    ```

    ## Notes

    - Fixing 100% CPU: Disabling the "Ok Google" Hotword detection:
    - Fixing 100% CPU: Disabling the "Ok Google" Hotword detection (run this after the emulator has loaded):

    ```
    ./adb shell "su root pm disable com.google.android.googlequicksearchbox"
    ```

    Note: run after Emulator loaded

    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.
  8. yazinsai revised this gist Jul 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -64,7 +64,7 @@ echo "hw.sensors.temperature=no" >> /opt/android-sdk/avd/config.ini
    # Running the Emulator (on VNC):

    ```
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -no-window -no-audio -gpu swiftshader_indirect -show-kernel
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -gpu swiftshader_indirect -show-kernel
    ```

    ## Notes
  9. yazinsai revised this gist Jul 31, 2019. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,17 @@ mkdir /opt/android-sdk/platforms
    ```bash
    sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal xfce4 vnc4server
    vncserver
    vncserver -geometry 1600x900
    ```

    Now modify the first block in `~/.vnc/xstartup`:

    ```
    # Uncomment the following two lines for normal desktop:
    unset SESSION_MANAGER
    # exec /etc/X11/xinit/xinitrc
    unset DBUS_SESSION_BUS_ADDRESS
    startxfce4 &
    ```

    See [https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5](https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5)
  10. yazinsai revised this gist Jul 31, 2019. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,11 @@ mkdir /opt/android-sdk/platforms

    # Install VNC

    ```bash
    sudo apt-get install ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal xfce4 vnc4server
    vncserver
    ```

    See [https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5](https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5)

    # Optional: enabling/disabling certain HW features
  11. yazinsai revised this gist Jul 31, 2019. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -11,12 +11,12 @@ echo "export ANDROID_SDK_ROOT=/opt/android-sdk" >> ~/.bashrc
    echo "export PATH=$PATH:$ANDROID_SDK_ROOT/tools" >> ~/.bashrc
    source ~/.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
    ./sdkmanager --update
    ./sdkmanager --licenses
    ./sdkmanager "system-images;android-25;google_apis;armeabi-v7a"
    ./sdkmanager "emulator"
    ./sdkmanager "platform-tools"
    touch ~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"
    ```
  12. yazinsai revised this gist Jul 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ```bash
    sudo apt update
    sudo apt install openjdk-8-jre
    sudo apt install openjdk-8-jre 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/
  13. yazinsai revised this gist Jul 31, 2019. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,8 @@
    # Steps for installing the Android Emulator from EC2 console:

    ```bash
    sudo apt-get install openjdk-8-jre
    sudo apt update
    sudo apt install openjdk-8-jre
    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/
    @@ -20,6 +21,10 @@ 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"
    ```

    # Install VNC

    See [https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5](https://medium.com/@Arafat./graphical-user-interface-using-vnc-with-amazon-ec2-instances-549d9c0969c5)

    # Optional: enabling/disabling certain HW features

    ```
  14. yazinsai revised this gist Jul 31, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # Steps for installing the Android Emulator from EC2 console:

    ```
    sudo apt install default-jdk # sudo apt-get install openjdk-8-jre (it install openjdk-11 by default on 18.04)
    ```bash
    sudo apt-get install openjdk-8-jre
    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/
  15. yazinsai revised this gist Jul 31, 2019. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    # Steps for installing the Android Emulator from EC2 console:

    ```
    sudo apt install default-jdk # sudo apt-get install openjdk-8-jre (it install openjdk-11 by default on 18.04)
    wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
    unzip sdk-tools-linux-4333796.zip -d android-sdk
    @@ -17,9 +18,11 @@ cd /opt/android-sdk/tools/bin
    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: enabling/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
    @@ -35,18 +38,22 @@ 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 (on VNC):

    ```
    /opt/android-sdk/emulator/emulator -ports 5554,5555 -avd MyAVD -no-window -no-audio -gpu swiftshader_indirect -show-kernel

    ```

    ## Notes

    - Fixing 100% CPU: Disabling the "Ok Google" Hotword detection:

    ```
    ./adb shell "su root pm disable com.google.android.googlequicksearchbox"
    ```

    Note: run after Emulator loaded

    1. We run ARM emulation on x86 instance.
  16. yazinsai renamed this gist Jul 31, 2019. 1 changed file with 12 additions and 13 deletions.
    25 changes: 12 additions & 13 deletions Android-Emulator-on-AWS-EC2.txt → Android-Emulator-on-AWS-EC2.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    Steps for installing the Android Emulator from EC2 console:
    -----------------------------------------------------------
    sudo apt install default-jdk
    # Steps for installing the Android Emulator from EC2 console:

    sudo apt install default-jdk # sudo apt-get install openjdk-8-jre (it install openjdk-11 by default on 18.04)
    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
    re-login
    source ~/.bashrc
    cd /opt/android-sdk/tools/bin
    /opt/android-sdk/tools/bin/sdkmanager --update
    /opt/android-sdk/tools/bin/sdkmanager --licenses
    @@ -18,8 +18,8 @@ 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
    -------------------------------------------------
    # Optional: enabling/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
    @@ -37,19 +37,18 @@ 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:
    ---------------------
    # Running the Emulator (on VNC):

    /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:
    -------------------------------------------------------------
    ## Notes

    - 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.
  17. @atyachin atyachin revised this gist Jun 17, 2019. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions Android-Emulator-on-AWS-EC2.txt
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,8 @@ Note: run after Emulator loaded

    Notes:
    ------
    1. We must use ARM ABI, since x86 requires KVM and EC2 instance doesn't support HW virtualization.
    2. We must disable GUI (-no-window) and audio (-no-audio) when running the emulator.
    3. We must specify "-gpu swiftshader_indirect" when running the emulator to prevent a boot loop.
    4. 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.
    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.
  18. @atyachin atyachin revised this gist Aug 12, 2018. 1 changed file with 23 additions and 3 deletions.
    26 changes: 23 additions & 3 deletions Android-Emulator-on-AWS-EC2.txt
    Original file line number Diff line number Diff line change
    @@ -17,20 +17,40 @@ cd /opt/android-sdk/tools/bin
    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 must use ARM ABI, since x86 requires KVM and EC2 instance doesn't support HW virtualization.
    2. We must disable GUI (-no-window) and audio (-no-audio) when running the emulator
    2. We must disable GUI (-no-window) and audio (-no-audio) when running the emulator.
    3. We must specify "-gpu swiftshader_indirect" when running the emulator to prevent a boot loop.
    4. Disabling the audio input/output in the AVD config is optional to prevent the system from trying to access the microphone (generates lots of errors in logcat)
    5. First startup takes VERY LONG time (can be over 30 minutes). Use "-show-kernel" to see kernel message and in secondary console window use "/opt/android-sdk/platform-tools/adb logcat" to see the system log while the emulator starts.
    4. 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.
  19. @atyachin atyachin revised this gist Aug 12, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Android-Emulator-on-AWS-EC2.txt
    Original file line number Diff line number Diff line change
    @@ -19,6 +19,7 @@ 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"
    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


    Running the Emulator:
  20. @atyachin atyachin renamed this gist Aug 12, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  21. @atyachin atyachin revised this gist Aug 12, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    Steps for installing the Android Emulator from EC2 console:
    -----------------------------------------------------------
    sudo apt install default-jdk
    wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
    unzip sdk-tools-linux-4333796.zip -d android-sdk
    @@ -19,10 +20,14 @@ mkdir /opt/android-sdk/platforms
    echo "hw.audioInput=no" >> /opt/android-sdk/avd/config.ini
    echo "hw.audioOutput=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


    Notes:
    ------
    1. We must use ARM ABI, since x86 requires KVM and EC2 instance doesn't support HW virtualization.
    2. We must disable GUI (-no-window) and audio (-no-audio) when running the emulator
    3. We must specify "-gpu swiftshader_indirect" when running the emulator to prevent a boot loop.
  22. @atyachin atyachin created this gist Aug 12, 2018.
    30 changes: 30 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    Steps for installing the Android Emulator from EC2 console:
    sudo apt install default-jdk
    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
    re-login
    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"
    echo "hw.audioInput=no" >> /opt/android-sdk/avd/config.ini
    echo "hw.audioOutput=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

    Notes:
    1. We must use ARM ABI, since x86 requires KVM and EC2 instance doesn't support HW virtualization.
    2. We must disable GUI (-no-window) and audio (-no-audio) when running the emulator
    3. We must specify "-gpu swiftshader_indirect" when running the emulator to prevent a boot loop.
    4. Disabling the audio input/output in the AVD config is optional to prevent the system from trying to access the microphone (generates lots of errors in logcat)
    5. First startup takes VERY LONG time (can be over 30 minutes). Use "-show-kernel" to see kernel message and in secondary console window use "/opt/android-sdk/platform-tools/adb logcat" to see the system log while the emulator starts.