Skip to content

Instantly share code, notes, and snippets.

@lattice0
Last active May 17, 2022 20:31
Show Gist options
  • Select an option

  • Save lattice0/a9091df4755fcd67946b3949abf383a4 to your computer and use it in GitHub Desktop.

Select an option

Save lattice0/a9091df4755fcd67946b3949abf383a4 to your computer and use it in GitHub Desktop.

Revisions

  1. lattice0 revised this gist May 17, 2022. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -33,3 +33,10 @@ image.sysdir.1 = system-images/android-30/google_apis/x86_64/

    #Launch:
    ANDROID_SDK_ROOT=/home/lz/android_sdk_root ANDROID_AVD_HOME=$ANDROID_SDK_ROOT/.android/avd /home/lz/android_sdk_root/emulator/emulator -verbose @emu1

    #ADB redirection:
    # On Host
    #socat tcp-listen:5037,bind=192.168.122.1,reuseaddr,fork tcp:localhost:5037

    # On virtual machine
    #socat tcp-listen:5037,bind=localhost,reuseaddr,fork tcp:192.168.122.1:5037
  2. lattice0 revised this gist May 13, 2022. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    # Installs Android Emulator standalone, and creates a default emulator. You shouuld be able to re-run this script if it fails, everything should be redone
    # Installs Android Emulator standalone, and creates a default emulator. You shouuld be able to
    # re-run this script if it fails, everything should be redone
    set -x
    sudo apt-get update && sudo apt-get install -y openjdk-11-jdk
    export ANDROID_SDK_ROOT=/home/$USER/android_sdk_root
  3. lattice0 revised this gist May 13, 2022. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    set -ex
    # Installs Android Emulator standalone, and creates a default emulator. You shouuld be able to re-run this script if it fails, everything should be redone
    set -x
    sudo apt-get update && sudo apt-get install -y openjdk-11-jdk
    export ANDROID_SDK_ROOT=/home/$USER/android_sdk_root
    rm -rf $ANDROID_SDK_ROOT
    @@ -21,7 +22,7 @@ avdmanager --verbose create avd --force \
    --tag "google_apis" \
    --abi "x86_64"

    sed -i '/android_sdk_root\//d' /home/$USER/.android/avd/emu1.avd/config.ini
    sed -i 's/android_sdk_root\///g' /home/lz/.android/avd/emu1.avd/config.ini
    # the live above changes
    image.sysdir.1 = android_sdk_root/system-images/android-30/google_apis/x86_64/
    # to
  4. lattice0 revised this gist May 13, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,8 @@ echo "$CMD_LINE_TOOLS_SHA256 command_line_tools.zip" | sha256sum -c -
    unzip command_line_tools.zip -d $ANDROID_SDK_ROOT
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/bin
    API_VER=30
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "system-images;android-$API_VER;google_apis;x86_64" "platforms;android-$API_VER"
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "emulator" "platform-tools"
    echo yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT "system-images;android-$API_VER;google_apis;x86_64" "platforms;android-$API_VER"
    echo yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT "emulator" "platform-tools"
    export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    avdmanager --verbose create avd --force \
  5. lattice0 revised this gist May 13, 2022. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -21,9 +21,8 @@ avdmanager --verbose create avd --force \
    --tag "google_apis" \
    --abi "x86_64"

    #TODO: fix this correction that is needed:
    nano /home/$USER/.android/avd/emu1.avd/config.ini
    # and change
    sed -i '/android_sdk_root\//d' /home/$USER/.android/avd/emu1.avd/config.ini
    # the live above changes
    image.sysdir.1 = android_sdk_root/system-images/android-30/google_apis/x86_64/
    # to
    image.sysdir.1 = system-images/android-30/google_apis/x86_64/
  6. lattice0 revised this gist May 13, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    set -ex
    sudo apt-get update && sudo apt-get install -y openjdk-11-jdk
    export ANDROID_SDK_ROOT=/home/$USER/android_sdk_root
    rm -rf $ANDROID_SDK_ROOT
    mkdir -p $ANDROID_SDK_ROOT
  7. lattice0 revised this gist May 7, 2022. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -9,23 +9,23 @@ echo "$CMD_LINE_TOOLS_SHA256 command_line_tools.zip" | sha256sum -c -
    unzip command_line_tools.zip -d $ANDROID_SDK_ROOT
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/bin
    API_VER=30
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "system-images;android-$API_VER;google_apis;x86" "platforms;android-$API_VER"
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "system-images;android-$API_VER;google_apis;x86_64" "platforms;android-$API_VER"
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "emulator" "platform-tools"
    export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    avdmanager --verbose create avd --force \
    --name "emu1" \
    --device "pixel" \
    --package "system-images;android-$API_VER;google_apis;x86" \
    --package "system-images;android-$API_VER;google_apis;x86_64" \
    --tag "google_apis" \
    --abi "x86"
    --abi "x86_64"

    #TODO: fix this correction that is needed:
    nano /home/$USER/.android/avd/emu1.avd
    nano /home/$USER/.android/avd/emu1.avd/config.ini
    # and change
    image.sysdir.1 = android_sdk_root/system-images/android-30/google_apis/x86/
    image.sysdir.1 = android_sdk_root/system-images/android-30/google_apis/x86_64/
    # to
    image.sysdir.1 = system-images/android-30/google_apis/x86/
    image.sysdir.1 = system-images/android-30/google_apis/x86_64/

    # Socat redirection: https://gist.github.com/lattice0/0040c1d29606c7a8f34c3b5b78814fdb

  8. lattice0 revised this gist Apr 16, 2022. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -27,4 +27,7 @@ image.sysdir.1 = android_sdk_root/system-images/android-30/google_apis/x86/
    # to
    image.sysdir.1 = system-images/android-30/google_apis/x86/

    # Socat redirection: https://gist.github.com/lattice0/0040c1d29606c7a8f34c3b5b78814fdb
    # Socat redirection: https://gist.github.com/lattice0/0040c1d29606c7a8f34c3b5b78814fdb

    #Launch:
    ANDROID_SDK_ROOT=/home/lz/android_sdk_root ANDROID_AVD_HOME=$ANDROID_SDK_ROOT/.android/avd /home/lz/android_sdk_root/emulator/emulator -verbose @emu1
  9. lattice0 revised this gist Apr 16, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -26,3 +26,5 @@ nano /home/$USER/.android/avd/emu1.avd
    image.sysdir.1 = android_sdk_root/system-images/android-30/google_apis/x86/
    # to
    image.sysdir.1 = system-images/android-30/google_apis/x86/

    # Socat redirection: https://gist.github.com/lattice0/0040c1d29606c7a8f34c3b5b78814fdb
  10. lattice0 revised this gist Apr 16, 2022. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -20,8 +20,9 @@ avdmanager --verbose create avd --force \
    --tag "google_apis" \
    --abi "x86"






    #TODO: fix this correction that is needed:
    nano /home/$USER/.android/avd/emu1.avd
    # and change
    image.sysdir.1 = android_sdk_root/system-images/android-30/google_apis/x86/
    # to
    image.sysdir.1 = system-images/android-30/google_apis/x86/
  11. lattice0 revised this gist Apr 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ sdkmanager --sdk_root=$ANDROID_SDK_ROOT "system-images;android-$API_VER;google_a
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "emulator" "platform-tools"
    export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    avdmanager --sdk_root=$ANDROID_SDK_ROOT --verbose create avd --force \
    avdmanager --verbose create avd --force \
    --name "emu1" \
    --device "pixel" \
    --package "system-images;android-$API_VER;google_apis;x86" \
  12. lattice0 revised this gist Apr 16, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -10,10 +10,10 @@ unzip command_line_tools.zip -d $ANDROID_SDK_ROOT
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/bin
    API_VER=30
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "system-images;android-$API_VER;google_apis;x86" "platforms;android-$API_VER"
    sdkmanager "emulator" "platform-tools"
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "emulator" "platform-tools"
    export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    avdmanager --verbose create avd --force \
    avdmanager --sdk_root=$ANDROID_SDK_ROOT --verbose create avd --force \
    --name "emu1" \
    --device "pixel" \
    --package "system-images;android-$API_VER;google_apis;x86" \
  13. lattice0 revised this gist Apr 16, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ mkdir -p $ANDROID_SDK_ROOT
    CMD_LINE_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip
    CMD_LINE_TOOLS_SHA256=d71f75333d79c9c6ef5c39d3456c6c58c613de30e6a751ea0dbd433e8f8b9cbf
    wget -O command_line_tools.zip $CMD_LINE_TOOLS_URL
    echo "CMD_LINE_TOOLS_SHA256 command_line_tools.zip" | sha256sum -c -
    echo "$CMD_LINE_TOOLS_SHA256 command_line_tools.zip" | sha256sum -c -
    unzip command_line_tools.zip -d $ANDROID_SDK_ROOT
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/bin
    API_VER=30
  14. lattice0 created this gist Apr 16, 2022.
    27 changes: 27 additions & 0 deletions emulator_init.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    set -ex
    export ANDROID_SDK_ROOT=/home/$USER/android_sdk_root
    rm -rf $ANDROID_SDK_ROOT
    mkdir -p $ANDROID_SDK_ROOT
    CMD_LINE_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip
    CMD_LINE_TOOLS_SHA256=d71f75333d79c9c6ef5c39d3456c6c58c613de30e6a751ea0dbd433e8f8b9cbf
    wget -O command_line_tools.zip $CMD_LINE_TOOLS_URL
    echo "CMD_LINE_TOOLS_SHA256 command_line_tools.zip" | sha256sum -c -
    unzip command_line_tools.zip -d $ANDROID_SDK_ROOT
    export PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/bin
    API_VER=30
    sdkmanager --sdk_root=$ANDROID_SDK_ROOT "system-images;android-$API_VER;google_apis;x86" "platforms;android-$API_VER"
    sdkmanager "emulator" "platform-tools"
    export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    avdmanager --verbose create avd --force \
    --name "emu1" \
    --device "pixel" \
    --package "system-images;android-$API_VER;google_apis;x86" \
    --tag "google_apis" \
    --abi "x86"