Run "Instant Run" from command line
Asked Answered
S

3

9

I'm running my Android app from Android Studio, and Instant Run kicks in, which is great. I want to run the exact same thing from the command-line.

In Android Studio's Event Log, I see

22:00:28 Executing tasks: [:app:incrementalDevDebugSupportDex]
22:00:48 Gradle build finished in 20s 286ms
22:00:51 Instant Run applied code changes and restarted the current Activity.

So, I expected I would be able to run that task from the command line: ./gradlew :app:incrementalDevDebugSupportDex. However, it's not found:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'incrementalDevDebugSupportDex' not found in project ':app'.

Is there a way to run with Instant Run from the command line?

Sholeen answered 4/3, 2016 at 3:7 Comment(0)
C
9

It is currently not possible to use instant run outside of Android Studio. This was mentioned at the Android Dev Summit, but I can't recall exactly in which talk that was.

Condyle answered 5/3, 2016 at 13:37 Comment(2)
well that's a letdown. i did exactly what OP did. why would they tie this functionality to an IDE...Shaff
I believe it was mentioned in the fireside chat but I could track down the timestamp quicklySimasimah
G
3

You can run instant-run from command line like this:

./gradlew clean :sample-app:assembleDebug -Pandroid.optional.compilation=INSTANT_DEV -Pandroid.injected.build.api=24
Garibull answered 13/3, 2017 at 10:10 Comment(0)
S
1

As of now it is possible. You can run the below command to make an instant run :

./gradlew :app:incremental"buildvarientname"DebugJavaCompilationSafeguard

You can add the same in gradle task also by adding incremental"buildvarientname"DebugJavaCompilationSafeguard inside the task on the run configuration window,

Sodium answered 29/1, 2018 at 14:48 Comment(2)
why don't I see these tasks when running ./gradlew :app:tasks ?Sweetener
hmmm i dont see it in the tasks either.Laicize

© 2022 - 2024 — McMap. All rights reserved.