Created
January 24, 2014 17:36
-
-
Save alterakey/8602153 to your computer and use it in GitHub Desktop.
Experimental Launcher for Android Gradle Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Patch in | |
task launchDebug(dependsOn: 'installDebug') << { | |
final String cmdline = "bash ${projectDir}/../gradle/start-intent.sh android.intent.action.MAIN ${project.tasks.generateDebugBuildConfig.appPackageName} .activity.MainActivity" | |
final Process p = cmdline.execute() | |
p.in.eachLine { l -> println l } | |
final int code = p.waitFor() | |
if (code != 0) { | |
throw new RuntimeException("Task exited with code " + code + ": " + cmdline) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Place it in /project/gradle/ | |
intent=$1 | |
pkg=$2 | |
activity=$3 | |
intr() { | |
adb shell am start -a android.intent.action.MAIN -c android.intent.category.HOME | |
exit 0 | |
} | |
trap intr INT | |
adb shell am start -a $intent -n $pkg/$activity & | |
adb logcat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment