How to prevent Android Studio 2.0 from doing a complete clean build after uninstalling app from device?
Asked Answered
C

2

10

I've been using Android Studio 2.0 Beta 5 with Gradle plugin 2.0.0-beta5. I've had Instant Run feature enabled, which is very useful when I want to do a quick change-and-test. Because it usually needs 50 seconds for my project to do a complete :assembleDebug. With Instant Run, I've been able to get my changed code running on device within about 10 seconds.

However, when I need to remove the app from the test device and have a complete new install. Android Studio always do the following thing when I click the "Run" button for the next time:

:clean, :generateDebugSources, :generateDebugAndroidTestSources, :prepareDebugUnitTestDependencies, :mockableAndroidJar, :assembleDebug

This is very slow. It takes up about 2 minutes for my project.

Is there a way to disable this behaviour? Or why is it not possible?

Cockroach answered 18/2, 2016 at 1:56 Comment(0)
T
0

The instant run, in order to be faster only target the API of the selected device.

Instant run uses different techniques to perform hot, warm, and cold swaps that are specific to the API level of the target device

Instant run ref.

But if you just need to push the apk again, you can use the gradle task install... (in general install+Flavor+Type i.e.:installProdRelease installPaidDebug) or use ADB to install your APK manually.

Triploid answered 26/2, 2016 at 18:38 Comment(0)
S
0

Got the same problem.
Fixed by turning off Instant Run
(File -> Settings -> Build, Execution, Deployment -> Instant Run)

Schopenhauerism answered 28/11, 2016 at 6:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.