Snippets For Instant Run Mode #203

hwangjr opened this Issue Jan 9, 2017 · 1 comment


None yet

1 participant

hwangjr commented Jan 9, 2017

I found the code snippets for how to check Instant Run Mode. Amigo check the instant task, and other way is to get the scope for variant and get the mode from context. I think maybe this will improve the amigo to check the Instant Run Mode. Here is the code:

                println 'check instant run'
                Task instantRunTask = project.tasks.findByName("transformClassesWithInstantRunVerifierFor${}")
                if (instantRunTask) {
                    throw RuntimeException("Sorry, instant run conflicts with Amigo, so please disable Instant Run")
    public static boolean isInInstantRunMode(Object variant) {
        try {
            def scope = variant.getVariantData().getScope()
            InstantRunBuildContext instantRunBuildContext = scope.getInstantRunBuildContext()
            return instantRunBuildContext.isInInstantRunMode()
        } catch (Throwable e) {
        return false

Maybe this code snippets can help you.

hwangjr commented Jan 10, 2017

Just for tips, close issue.

@hwangjr hwangjr closed this Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment