Skip to content

Instantly share code, notes, and snippets.

@atakane
Last active September 16, 2015 15:16
Show Gist options
  • Save atakane/7549f5bb213edc99de79 to your computer and use it in GitHub Desktop.
Save atakane/7549f5bb213edc99de79 to your computer and use it in GitHub Desktop.
Auto install .apk files on to the Genymotion's simulator
#!/bin/bash
#Genymotion app path
GM=/Applications/Genymotion.app/Contents/MacOS/player.app/Contents/MacOS/tools
#Process each file found in the source folder recursively
for f in "$@"
do
#installing the package
$GM/adb install -r "$f"
#finding the activities in the APK
pkg=$($GM/aapt dump badging "$f"|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}')
act=$($GM/aapt dump badging "$f"|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}')
#starting the apk
$GM/adb shell am start -n $pkg/$act
#removing .apk from install location
rm "$f";
done
#refs:
#http://stackoverflow.com/questions/6109234/how-to-run-not-only-install-an-android-application-using-apk-file
#http://apple.blogoverflow.com/2012/06/folder-actions-tutorial-automation-meet-the-filesystem/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment