Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
android-rocket-launcher
extras updated readme Jun 2, 2017
gradle/wrapper
.gitignore first commit May 28, 2016
LICENSE.txt updated readme, added licence Jul 4, 2016
README.md
build.gradle
gradle.properties first commit May 28, 2016
gradlew
gradlew.bat
settings.gradle

README.md

Android Rocket Launcher Download

Gradle plugin that adds tasks to your android modules for installing and launching all variants.

How to use

Paste this code into your module's build.gradle

apply plugin: 'android-rocket-launcher'

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.cesarferreira:android-rocket-launcher:0.2.3'
    }
}

Now, when you run ./gradlew tasks, you'll see something like this:

openDemoDebug - Installs and opens DebugDemo build
openFreeDebug - Installs and opens DebugFree build
openPaidDebug - Installs and opens DebugPaid build

Alternative

Copy-pasting this gradle task on every project

// Running the APK on your Android Device
android.applicationVariants.all { variant ->
    if (variant.install) {
        tasks.create(name: "run${variant.name.capitalize()}", type: Exec,
                dependsOn: variant.install) {
            group = 'Run'
            description "Installs and Runs the APK for ${variant.description}."
            def getMainActivity = { file ->
                new XmlSlurper().parse(file).application.activity.find {
                    it.'intent-filter'.find { filter ->
                        return filter.action.find {
                            it.'@android:name'.text() == 'android.intent.action.MAIN'
                        } \
                                 && filter.category.find {
                            it.'@android:name'.text() == 'android.intent.category.LAUNCHER'
                        }
                    }
                }.'@android:name'
            }
            doFirst {
                def activityClass =
                        getMainActivity(variant.outputs.processManifest.manifestOutputFile)
                commandLine android.adbExe, 'shell', 'am', 'start', '-n',
                        "${variant.applicationId}/${activityClass}"
            }
        }
    }
}

It's a no brainer 😄