I keep hearing instant run discussed as if it's in a great shape, however my team and I regularly experience significant issues with the feature, and a degraded coding experience because of it.
Before instant run, our clean builds were ~1min 30sec, and after that we'd get builds that were ~25sec or the occasional 40sec. While instant run does indeed seem to decrease builds sometimes to 6-12 seconds, other times, it's caused us to get into crazy long builds that we've seen take as long as 13 minutes, largely offsetting any gains from the incremental compile.
It also seems that a majority of the time, small changes are still taking 40 seconds. Sometimes it's 6 seconds, but that's pretty rare.
It feels a lot like instant run has degraded our ability to work consistently and efficiently. Here are some of our app specific configurations:
Android Studio 2.1.1, Android Plugin 2.1
multiDexEnabled true
dexOptions {
preDexLibraries true
javaMaxHeapSize "4g"
maxProcessCount 4
incremental true
dexInProcess true
}
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx6g -XX:MaxPermSize=512m
Are we doing something wrong, or has anyone found a work around?
EDIT: Several devs seem to be encountering this. I'm tracking a bug here. Feel free to star it and add to the discussion.
We Want Your Feedback! Instant Run is currently available only in Android Studio 2.0, and higher. We will continue to improve the feature in subsequent releases. If you run into any additional issues, please help by logging bugs in our public Issues Tracker.
There may be many plugins in Android Studio that you are not using it. Disabling it will free up some space and reduce complex processes. To do so, Open Preferences >> Plugins and Disable the plugins you are not using.
Product Flavors so what are they? Simply put, a product flavor is a variant of your app. It is very useful when you want to create multiple versions of your app. This means you can generate different versions or variants of your app using a single codebase.
We're getting much better performance out of instant run now. Here are the changes we made:
Application
to be reloaded. Instead we started using the cold swap feature. Cold swap is triggered by the "Rerun" button, which is 4 buttons to the right of the play / start button in Android Studio. It's the stop button with the arrow coming out the left hand side and going up. Cold swapping the code in instant run we found more reliable, and it also performs a full application restart, essentially acting like a normal build, except faster.Overall it's still not perfect. I still have to endure strange build issues, and do build cleans occasionally. Still feels like a beta.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With