Skip to content

Instantly share code, notes, and snippets.

@samukasmk
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save samukasmk/948e249db46df77f897e to your computer and use it in GitHub Desktop.

Select an option

Save samukasmk/948e249db46df77f897e to your computer and use it in GitHub Desktop.

Revisions

  1. samukasmk revised this gist May 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -153,7 +153,7 @@ case $1 in
    transfer_project_file_to_phone
    start_app_in_kivy_launcher
    ;;
    'deploy')
    'deploy') #buildozer setdefault android debug deploy run
    buildozer android debug deploy run

    ;;
  2. samukasmk revised this gist May 17, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -62,7 +62,7 @@

    # SET YOUR VARIABLES HERE
    ANDROID_SDK_PATH='/home/samuel/.buildozer/android/platform/android-sdk-21'
    KIVY_PROJECT_PATH=$(pwd)
    KIVY_PROJECT_PATH=$(pwd) # it can be the entire path of your project too

    # down here let me define by myself
    KIVY_REMOTE_FOLDER='/sdcard/kivy'
    @@ -158,4 +158,4 @@ case $1 in

    ;;
    *) buildozer android debug deploy run
    esac
    esac
  3. samukasmk revised this gist May 17, 2015. 1 changed file with 92 additions and 69 deletions.
    161 changes: 92 additions & 69 deletions deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    #!/bin/bash
    #
    # script: deploy_kivy_app_with_kivy_launcher.sh
    #
    #
    # by: Samuel Maciel Sampaio [20140717]
    #
    #
    # contact: samukasmk@gmail.com
    #
    # goal:
    #
    # goal:
    # Develop kivy apps for android and quickly test directly in your
    # android devices with a simple and dynamically way, without to
    # create un apk package (that takes a lot lot time!)
    #
    #
    # How can i do this ? Transfering the files of your kivy project
    # directly to sdcard of the android device and start the app (Kivy
    # Launcher)
    @@ -23,27 +23,27 @@
    #
    # 2. Have android app (Kivy Launcher) installed in the android device
    # Link: https://play.google.com/store/apps/details?id=org.kivy.pygame
    #
    #
    # 3. Have the android sdk uncompressed in your computer
    # Link: http://developer.android.com/sdk/index.html
    #
    # 4. Have buildozer installed:
    # Link: http://buildozer.readthedocs.org/en/latest/installation.html#targeting-android
    #
    # Extra: (installation on ubuntu 13.10 or higher)
    # Extra: (installation on ubuntu 13.10 or higher)
    # sudo pip install --upgrade cython
    # sudo dpkg --add-architecture i386
    # sudo apt-get update
    # sudo apt-get install build-essential ccache git libncurses5:i386 \
    # libstdc++6:i386 python2.7 python2.7-dev \
    # openjdk-7-jdk unzip zlib1g-dev zlib1g:i386
    #
    # 5. Define the ANDROID_SDK_PATH variable with the folder path of
    # 5. Define the ANDROID_SDK_PATH variable with the folder path of
    # your android sdk, (with you use buildozer your sdk will be here:
    # ~/.buildozer/android/platform/android-sdk..)
    #
    # 6. Define the KIVY_PROJECT_PATH variable with the folder path of
    # your kivy project
    # your kivy project
    #
    # Thats All Folks!
    #
    @@ -62,77 +62,100 @@

    # SET YOUR VARIABLES HERE
    ANDROID_SDK_PATH='/home/samuel/.buildozer/android/platform/android-sdk-21'
    KIVY_PROJECT_PATH=$(pwd) # or you can pass the path of project eg: '../my_kivy_project_path' or eg: '/home/samuel/projects//my_kivy_project'
    KIVY_PROJECT_PATH=$(pwd)

    # down here let me define by myself
    KIVY_REMOTE_FOLDER='/sdcard/kivy'
    KIVY_PROJECT_FOLDER=$(basename $KIVY_PROJECT_PATH)
    IGNORE_TERMS=( .apk .git buildozer )

    echo -n "Defining the adb command path: "
    if [ -f "$ANDROID_SDK_PATH/platform-tools/adb" ];
    then
    ADB="$ANDROID_SDK_PATH/platform-tools/adb";
    echo -e "[ OK ]\nadb path: $ADB\n"
    elif [ -f "$ANDROID_SDK_PATH/tools/adb" ];
    then
    ADB="$ANDROID_SDK_PATH/tools/adb";
    echo -e "[ OK ]\nadb path: $ADB\n"
    else
    echo -e "[FAILED]\nImpossible to find 'adb' command in SDK Path: $ANDROID_SDK_PATH"
    exit 1
    fi
    function check_required_tools() {
    echo -n "Defining the adb command path: "
    if [ -f "$ANDROID_SDK_PATH/platform-tools/adb" ];
    then
    ADB="$ANDROID_SDK_PATH/platform-tools/adb";
    echo -e "[ OK ]\nadb path: $ADB\n"
    elif [ -f "$ANDROID_SDK_PATH/tools/adb" ];
    then
    ADB="$ANDROID_SDK_PATH/tools/adb";
    echo -e "[ OK ]\nadb path: $ADB\n"
    else
    echo -e "[FAILED]\nImpossible to find 'adb' command in SDK Path: $ANDROID_SDK_PATH"
    exit 1
    fi
    }

    function check_connected_devices() {
    echo -n "Checking if there are devices connected: "
    DEVICES_CONNECTED=$($ADB devices | grep -v List | grep -v '^$' | wc -l)
    if [ "$DEVICES_CONNECTED" -lt "1" ];
    then
    echo -e "[FAILED]\nNot Found Devices Connected with this computer \!"
    exit 2
    else
    echo -e "[ OK ]\n"
    fi
    }

    function transfer_project_file_to_phone() {
    cd $(dirname $KIVY_PROJECT_PATH)

    IGNORED_FILES=''
    for TERM in ${IGNORE_TERMS[*]};
    do
    IGNORED_FILES="$IGNORED_FILES | grep -v '$TERM'"
    done

    echo -n "Checking if there are devices connected: "
    DEVICES_CONNECTED=$($ADB devices | grep -v List | grep -v '^$' | wc -l)
    if [ "$DEVICES_CONNECTED" -lt "1" ];
    then
    echo -e "[FAILED]\nNot Found Devices Connected with this computer \!"
    exit 2
    else
    echo -e "[ OK ]\n"
    fi
    echo -n "Finding kivy project folders: "
    KIVY_PROJECT_FOLDERS=($(eval find $KIVY_PROJECT_FOLDER -type d $IGNORED_FILES))
    if [ "$?" -eq "0" ];
    then
    echo -e "[ OK ]\n"
    else
    echo -e "[FAILED]\n"
    fi

    cd $(dirname $KIVY_PROJECT_PATH)
    echo -n "Finding kivy project files: "
    KIVY_PROJECT_FILES=($(eval find $KIVY_PROJECT_FOLDER -type f $IGNORED_FILES))
    if [ "$?" -eq "0" ];
    then
    echo -e "[ OK ]\n"
    else
    echo -e "[FAILED]\n"
    fi

    IGNORED_FILES=''
    for TERM in ${IGNORE_TERMS[*]};
    do
    IGNORED_FILES="$IGNORED_FILES | grep -v '$TERM'"
    done
    echo -n "Ensuring that Kivy folders exists..."
    $ADB shell mkdir -p $KIVY_REMOTE_FOLDER
    for KIVY_PROJECT_FOLDER in ${KIVY_PROJECT_FOLDERS[*]};
    do
    $ADB shell mkdir -p $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FOLDER
    done
    echo -e "\n"

    echo -n "Finding kivy project folders: "
    KIVY_PROJECT_FOLDERS=($(eval find $KIVY_PROJECT_FOLDER -type d $IGNORED_FILES))
    if [ "$?" -eq "0" ];
    then
    echo -e "[ OK ]\n"
    else
    echo -e "[FAILED]\n"
    fi
    echo "Initilizing file transfer:"
    for KIVY_PROJECT_FILE in ${KIVY_PROJECT_FILES[*]};
    do
    echo "$KIVY_PROJECT_FILE -> $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FILE "
    $ADB push -p $KIVY_PROJECT_FILE $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FILE
    echo ""
    done
    }

    echo -n "Finding kivy project files: "
    KIVY_PROJECT_FILES=($(eval find $KIVY_PROJECT_FOLDER -type f $IGNORED_FILES))
    if [ "$?" -eq "0" ];
    then
    echo -e "[ OK ]\n"
    else
    echo -e "[FAILED]\n"
    fi
    function start_app_in_kivy_launcher() {
    $ADB shell am start -n org.kivy.pygame/org.renpy.android.ProjectChooser
    }

    echo -n "Ensuring that Kivy folders exists..."
    $ADB shell mkdir -p $KIVY_REMOTE_FOLDER
    for KIVY_PROJECT_FOLDER in ${KIVY_PROJECT_FOLDERS[*]};
    do
    $ADB shell mkdir -p $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FOLDER
    done
    echo -e "\n"
    case $1 in
    'test_kivy_launcher')
    check_required_tools
    check_connected_devices

    echo "Initilizing file transfer:"
    for KIVY_PROJECT_FILE in ${KIVY_PROJECT_FILES[*]};
    do
    echo "$KIVY_PROJECT_FILE -> $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FILE "
    $ADB push -p $KIVY_PROJECT_FILE $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FILE
    echo ""
    done
    transfer_project_file_to_phone
    start_app_in_kivy_launcher
    ;;
    'deploy')
    buildozer android debug deploy run

    $ADB shell am start -n org.kivy.pygame/org.renpy.android.ProjectChooser
    ;;
    *) buildozer android debug deploy run
    esac
  4. samukasmk revised this gist May 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -62,7 +62,7 @@

    # SET YOUR VARIABLES HERE
    ANDROID_SDK_PATH='/home/samuel/.buildozer/android/platform/android-sdk-21'
    KIVY_PROJECT_PATH='../my_project_path'
    KIVY_PROJECT_PATH=$(pwd) # or you can pass the path of project eg: '../my_kivy_project_path' or eg: '/home/samuel/projects//my_kivy_project'

    # down here let me define by myself
    KIVY_REMOTE_FOLDER='/sdcard/kivy'
  5. samukasmk revised this gist May 17, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -61,8 +61,8 @@
    #

    # SET YOUR VARIABLES HERE
    ANDROID_SDK_PATH='~/.buildozer/android/platform/android-sdk-21'
    KIVY_PROJECT_PATH='/Path/to/your/kivy/project'
    ANDROID_SDK_PATH='/home/samuel/.buildozer/android/platform/android-sdk-21'
    KIVY_PROJECT_PATH='../my_project_path'

    # down here let me define by myself
    KIVY_REMOTE_FOLDER='/sdcard/kivy'
  6. samukasmk revised this gist Nov 1, 2014. 1 changed file with 13 additions and 2 deletions.
    15 changes: 13 additions & 2 deletions deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -27,11 +27,22 @@
    # 3. Have the android sdk uncompressed in your computer
    # Link: http://developer.android.com/sdk/index.html
    #
    # 4. Define the ANDROID_SDK_PATH variable with the folder path of
    # 4. Have buildozer installed:
    # Link: http://buildozer.readthedocs.org/en/latest/installation.html#targeting-android
    #
    # Extra: (installation on ubuntu 13.10 or higher)
    # sudo pip install --upgrade cython
    # sudo dpkg --add-architecture i386
    # sudo apt-get update
    # sudo apt-get install build-essential ccache git libncurses5:i386 \
    # libstdc++6:i386 python2.7 python2.7-dev \
    # openjdk-7-jdk unzip zlib1g-dev zlib1g:i386
    #
    # 5. Define the ANDROID_SDK_PATH variable with the folder path of
    # your android sdk, (with you use buildozer your sdk will be here:
    # ~/.buildozer/android/platform/android-sdk..)
    #
    # 5. Define the KIVY_PROJECT_PATH variable with the folder path of
    # 6. Define the KIVY_PROJECT_PATH variable with the folder path of
    # your kivy project
    #
    # Thats All Folks!
  7. samukasmk revised this gist Jul 17, 2014. 1 changed file with 33 additions and 2 deletions.
    35 changes: 33 additions & 2 deletions deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,40 @@
    # How can i do this ? Transfering the files of your kivy project
    # directly to sdcard of the android device and start the app (Kivy
    # Launcher)
    #
    # Have Fun!
    #
    #
    # Dependencies:
    # 1. Have a usb cable connect in your computer and android device
    #
    # 2. Have android app (Kivy Launcher) installed in the android device
    # Link: https://play.google.com/store/apps/details?id=org.kivy.pygame
    #
    # Thanks, Have Fun!
    #
    # 3. Have the android sdk uncompressed in your computer
    # Link: http://developer.android.com/sdk/index.html
    #
    # 4. Define the ANDROID_SDK_PATH variable with the folder path of
    # your android sdk, (with you use buildozer your sdk will be here:
    # ~/.buildozer/android/platform/android-sdk..)
    #
    # 5. Define the KIVY_PROJECT_PATH variable with the folder path of
    # your kivy project
    #
    # Thats All Folks!
    #
    # Observation:
    # If you never heard about buildozer, research it, because it's really
    # worthwhile! it automates many processes to build the package creation
    # .apk, and just as I open (Kivy Launcher) at the end of the deployment,
    # it installs and opens your app Kivy you just package all in one command.
    # Links:
    # - http://buildozer.readthedocs.org/en/latest/
    # - https://pypi.python.org/pypi/buildozer/0.14
    # - https://github.com/kivy/buildozer
    # - http://kivy.org/docs/guide/packaging-android.html#buildozer
    #
    #

    # SET YOUR VARIABLES HERE
    ANDROID_SDK_PATH='~/.buildozer/android/platform/android-sdk-21'
  8. samukasmk created this gist Jul 17, 2014.
    96 changes: 96 additions & 0 deletions deploy_kivy_app_with_kivy_launcher.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,96 @@
    #!/bin/bash
    #
    # script: deploy_kivy_app_with_kivy_launcher.sh
    #
    # by: Samuel Maciel Sampaio [20140717]
    #
    # contact: samukasmk@gmail.com
    #
    # goal:
    # Develop kivy apps for android and quickly test directly in your
    # android devices with a simple and dynamically way, without to
    # create un apk package (that takes a lot lot time!)
    #
    # How can i do this ? Transfering the files of your kivy project
    # directly to sdcard of the android device and start the app (Kivy
    # Launcher)
    #
    # Thanks, Have Fun!
    #

    # SET YOUR VARIABLES HERE
    ANDROID_SDK_PATH='~/.buildozer/android/platform/android-sdk-21'
    KIVY_PROJECT_PATH='/Path/to/your/kivy/project'

    # down here let me define by myself
    KIVY_REMOTE_FOLDER='/sdcard/kivy'
    KIVY_PROJECT_FOLDER=$(basename $KIVY_PROJECT_PATH)
    IGNORE_TERMS=( .apk .git buildozer )

    echo -n "Defining the adb command path: "
    if [ -f "$ANDROID_SDK_PATH/platform-tools/adb" ];
    then
    ADB="$ANDROID_SDK_PATH/platform-tools/adb";
    echo -e "[ OK ]\nadb path: $ADB\n"
    elif [ -f "$ANDROID_SDK_PATH/tools/adb" ];
    then
    ADB="$ANDROID_SDK_PATH/tools/adb";
    echo -e "[ OK ]\nadb path: $ADB\n"
    else
    echo -e "[FAILED]\nImpossible to find 'adb' command in SDK Path: $ANDROID_SDK_PATH"
    exit 1
    fi

    echo -n "Checking if there are devices connected: "
    DEVICES_CONNECTED=$($ADB devices | grep -v List | grep -v '^$' | wc -l)
    if [ "$DEVICES_CONNECTED" -lt "1" ];
    then
    echo -e "[FAILED]\nNot Found Devices Connected with this computer \!"
    exit 2
    else
    echo -e "[ OK ]\n"
    fi

    cd $(dirname $KIVY_PROJECT_PATH)

    IGNORED_FILES=''
    for TERM in ${IGNORE_TERMS[*]};
    do
    IGNORED_FILES="$IGNORED_FILES | grep -v '$TERM'"
    done

    echo -n "Finding kivy project folders: "
    KIVY_PROJECT_FOLDERS=($(eval find $KIVY_PROJECT_FOLDER -type d $IGNORED_FILES))
    if [ "$?" -eq "0" ];
    then
    echo -e "[ OK ]\n"
    else
    echo -e "[FAILED]\n"
    fi

    echo -n "Finding kivy project files: "
    KIVY_PROJECT_FILES=($(eval find $KIVY_PROJECT_FOLDER -type f $IGNORED_FILES))
    if [ "$?" -eq "0" ];
    then
    echo -e "[ OK ]\n"
    else
    echo -e "[FAILED]\n"
    fi

    echo -n "Ensuring that Kivy folders exists..."
    $ADB shell mkdir -p $KIVY_REMOTE_FOLDER
    for KIVY_PROJECT_FOLDER in ${KIVY_PROJECT_FOLDERS[*]};
    do
    $ADB shell mkdir -p $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FOLDER
    done
    echo -e "\n"

    echo "Initilizing file transfer:"
    for KIVY_PROJECT_FILE in ${KIVY_PROJECT_FILES[*]};
    do
    echo "$KIVY_PROJECT_FILE -> $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FILE "
    $ADB push -p $KIVY_PROJECT_FILE $KIVY_REMOTE_FOLDER/$KIVY_PROJECT_FILE
    echo ""
    done

    $ADB shell am start -n org.kivy.pygame/org.renpy.android.ProjectChooser