Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hello009-commits/da2b324bcac251ed956acdbed7c0d18e to your computer and use it in GitHub Desktop.
Save hello009-commits/da2b324bcac251ed956acdbed7c0d18e to your computer and use it in GitHub Desktop.

Revisions

  1. @nhtua nhtua revised this gist Dec 13, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 01.emulator-up.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ set -e #stop immediately if any error happens
    avd_name=$1

    if [[ -z "$avd_name" ]]; then
    $avd_name="avd28"
    avd_name="avd28"
    fi

    #check if emulator work well
  2. @nhtua nhtua revised this gist Dec 13, 2019. 2 changed files with 3 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion 00.install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/bash -i
    #Using shebang with -i to enable interactive mode (auto load .bashrc)
    #using shebang with -i to enable interactive mode (auto load .bashrc)

    set -e #stop immediately if any error happens

    3 changes: 2 additions & 1 deletion 01.emulator-up.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    #!/bin/bash -i
    #Using shebang with -i to enable interactive mode (auto load .bashrc)
    #using shebang with -i to enable interactive mode (auto load .bashrc)
    #this script was inspired from https://docs.travis-ci.com/user/languages/android/

    set -e #stop immediately if any error happens

  3. @nhtua nhtua revised this gist Dec 13, 2019. 2 changed files with 4 additions and 1 deletion.
    1 change: 1 addition & 0 deletions 00.install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    #!/bin/bash -i
    #Using shebang with -i to enable interactive mode (auto load .bashrc)

    set -e #stop immediately if any error happens

    4 changes: 3 additions & 1 deletion 01.emulator-up.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    #!/usr/bin/env bash
    #!/bin/bash -i
    #Using shebang with -i to enable interactive mode (auto load .bashrc)

    set -e #stop immediately if any error happens

    avd_name=$1
  4. @nhtua nhtua revised this gist Dec 13, 2019. No changes.
  5. @nhtua nhtua revised this gist Dec 13, 2019. 2 changed files with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install-android-sdk.sh → 00.install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -25,5 +25,5 @@ yes | sdkmanager "platform-tools" "platforms;android-28" "emulator"
    yes | sdkmanager "system-images;android-28;google_apis;x86_64"
    emulator -version

    #TODO add script to create Android Virtual Device (AVD) and start it
    #You can find the ideas from https://docs.travis-ci.com/user/languages/android/
    echo "INSTALL ANDROID SDK DONE!"
    echo "run 01.emulator-up.sh [new device name] to start emulator"
    File renamed without changes.
  6. @nhtua nhtua revised this gist Dec 13, 2019. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions emulator-up.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/usr/bin/env bash
    set -e #stop immediately if any error happens

    avd_name=$1

    if [[ -z "$avd_name" ]]; then
    $avd_name="avd28"
    fi

    #check if emulator work well
    emulator -version

    # create virtual device, default using Android 9 Pie image (API Level 28)
    echo no | avdmanager create avd -n avd28 -k "system-images;android-28;google_apis;x86_64"

    # start the emulator
    emulator -avd avd28 -no-audio -no-window &

    # show connected virtual device
    adb devices
  7. @nhtua nhtua revised this gist Dec 13, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/bin/bash
    #!/bin/bash -i

    set -e #stop immediately if any error happens

  8. @nhtua nhtua revised this gist Dec 12, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -25,3 +25,5 @@ yes | sdkmanager "platform-tools" "platforms;android-28" "emulator"
    yes | sdkmanager "system-images;android-28;google_apis;x86_64"
    emulator -version

    #TODO add script to create Android Virtual Device (AVD) and start it
    #You can find the ideas from https://docs.travis-ci.com/user/languages/android/
  9. @nhtua nhtua revised this gist Dec 12, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -13,10 +13,10 @@ java -version
    cd ~ && wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
    ANDROID_HOME=/opt/androidsdk
    mkdir -p $ANDROID_HOME
    apt install unzip && unzip sdk-tools-linux-4333796.zip -d $ANDROID_HOME
    apt install unzip -y && unzip sdk-tools-linux-4333796.zip -d $ANDROID_HOME

    echo "export ANDROID_HOME=$ANDROID_HOME" >> ~/.bashrc
    echo 'export SDK=$ANDROID_HOME' >> >> ~/.bashrc
    echo 'export SDK=$ANDROID_HOME' >> ~/.bashrc
    echo 'export PATH=$SDK/emulator:$SDK/tools:$SDK/tools/bin:$SDK/platform-tools:$PATH' >> ~/.bashrc
    source ~/.bashrc

  10. @nhtua nhtua revised this gist Dec 12, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ set -e #stop immediately if any error happens

    # Install Open SDK
    apt update
    apt install openjdk-8-jdk
    apt install openjdk-8-jdk -y
    update-java-alternatives --set java-1.8.0-openjdk-amd64
    java -version

  11. @nhtua nhtua created this gist Dec 12, 2019.
    27 changes: 27 additions & 0 deletions install-android-sdk.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/bin/bash

    set -e #stop immediately if any error happens

    # Install Open SDK
    apt update
    apt install openjdk-8-jdk
    update-java-alternatives --set java-1.8.0-openjdk-amd64
    java -version

    # Install SDK Manager
    # you can find this file at https://developer.android.com/studio/index.html#downloads - section command line only
    cd ~ && wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
    ANDROID_HOME=/opt/androidsdk
    mkdir -p $ANDROID_HOME
    apt install unzip && unzip sdk-tools-linux-4333796.zip -d $ANDROID_HOME

    echo "export ANDROID_HOME=$ANDROID_HOME" >> ~/.bashrc
    echo 'export SDK=$ANDROID_HOME' >> >> ~/.bashrc
    echo 'export PATH=$SDK/emulator:$SDK/tools:$SDK/tools/bin:$SDK/platform-tools:$PATH' >> ~/.bashrc
    source ~/.bashrc

    # Install Android Image version 28
    yes | sdkmanager "platform-tools" "platforms;android-28" "emulator"
    yes | sdkmanager "system-images;android-28;google_apis;x86_64"
    emulator -version