Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.

Hot code swap in Android development with new version: JRebel for Android 2.5

Another version, another milestone. The last update post was back in April about JRebel for Android 2.2. In this post you’ll get the highlights over the last 46(!) releases.

With all the latest improvements, you’ll want to try JRebel for Android even if you’ve already tried it in the past. Just search for JRebel for Android in the Android Studio or IntelliJ plugin repository and install it for free!

Improved startup times with JRebel for Android

A bit of background in case you’re not familiar: JRebel for Android enables faster Android app development by updating code and resources directly into running applications, otherwise known as hot swap or code reloading.

Though we eliminate those annoying build-install-run cycles in Android development, you’ll still need to build the initial APK and instrument the code to get JRebel for Android working. All of the newest features that we are highlighting are focused on improving the APK installation time, whether it’s the very first time or an incremental APK install.

All the following performance measurements are done using Google’s iosched project’s snapshot from 2015. If you are interested how the tests are set up and ran check out this talk from Madis.

Preparing the project in the background

JRebel for Android starts preparing the project in the background once you open it in Android Studio and the Gradle sync is finished. You’ll likely notice a progress bar displayed in the bottom part of your IDE. (Also huge thanks to @seebrock3r for introducing me to Nyan Progress Bar!)

JRebel for Android prepares your project in the background

This means the background preparation is in progress. It’s important to note that this background preparation is NONBLOCKING and you can do all of your development activities throughout the preparation. The preparation stops if Gradle is invoked on the IDE side to free up resources and avoid any build conflicts.

Here are some of our internal performance measurements from the very first clean installation vs. an install after warming up:

JRebel for Android 2.5 has faster APK installation time

The running warmup task in the background decreased the installation time to around 15 seconds from the previous 24 seconds.

Improved caching

We also invested in our caching capabilities. This has the greatest impact after running clean (either from the IDE or command line) and running JRebel for Android after it.

JRebel for Android has faster APK installation time

The line shows the application installation time going from 21 to 7 seconds after running clean with improved caching enabled.

Because of the new caching improvements, when you run your Gradle build, only compilation and resource packaging tasks are executed. A new APK will also be created and installed on the device.

Incremental Resources Processing

Incremental resources processing with aapt2 is available by default in Android Gradle Plugin 3.0. But if you’re using an Android Gradle Plugin older than 3.0 (all the way to 1.5 Android Gradle Plugin) we’ll use our custom fork of aapt2 to package and process the resources. This makes sure that you get the fastest build times and enables you to apply changes with JRebel for Android as quickly as possible.

To check what version of the Android Gradle Plugin you are using, check the build.gradle file in the root of your project and look for the following line:

dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
}

Summary

If you’re a professional Android developer, you’ll want to use JRebel for Android Enterprise which comes with custom annotation processors support and an incremental compiler which speeds up your reloads even more. Go grab it for free for 14 days from the Android Studio or IntelliJ plugin repository – even if you’ve already tried it in the past.

If you’re already one of our awesome customers, don’t forget to update to get take advantage of all this goodness!

LAST BUT NOT LEAST – There are countless smaller performance improvements, bug fixes and runtime integrations not mentioned in this post. Huge thanks to everyone who has provided us with bug reports, feedback, and found the time to jump on call to chat about Android and stuff!