What really annoys every android developer is build process. I know you agree with me guys but i am sure Google Dev team took this as a serious issue., that is why they come up with the beta version of Android Studio 2.0 earlier this week.
Studio 2.0 is now bundle with many new feature like instant run, a all new GPU Profiler and a brand new Android Emulator, that are surely created to increase our efficiency.
Instant Run: WYCIWYB: what you code is what you build
The coolest thing about the studio 2.0 is the instant run. It’s refreshes the current activity and reflect the changes on your device/emulator. Sounds GOOD lets see how it work’s.
- Download the Android Studio 2.0
2. If you have a pre-existing app open Settings/Preferences, the go to Build, Execution, Deployment → Instant Run. Click on Enable Instant Run…
Note: Click the Update Project link. When prompted, click OK.
Instant Run in Android Studio 2.0 allows you to quickly make changes to your app code while your app is running on an Android device or Android Emulator. Instead of waiting for your entire app to rebuild and redeploy after each code change, Android Studio 2.0 will try to incrementally build and push only the incremental code or resource change. Depending on the code changes you make, you can see the results of your change in under a second. By simply updating your app to use the latest Gradle plugin ( ‘com.android.tools.build:gradle:2.0.0-beta2
’ ), you can take advantage of this time saving features with no other modifications to your code. If your project is setup correctly with Instant Run, you will see a lightning bolt next to your Run button on the toolbar:
How/When Instant Run Works
- For method implementation changes: When only method implementations (including constructors) are changed, the changes are hot swapped. Your application keeps running and the new implementation is used the next time the method is called.
- For resource changes: When resources are changed, the changes are warm swapped. This is similar to a hot swap, except that the current Activity is restarted. You will notice a slight flicker on the screen as the Activity restarts.
- For structural code changes: When structural code changes are made–including changes to the class hierarchy, method signatures, static initializers, or fields–the changes are cold swapped. This will restart the whole application.
- For Android manifest changes: Instant Run is not supported, and your application will be re-installed.