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

4 top reasons you should try free version of JRebel for Android

Originally, Sten has published this post to his blog on Medium, but we think it’s a valuable addition to our library, so here it is in full. Enjoy!

Why try JRebel for Android Free?


JRebel for Android instantly pushes your code and resources changes to your running Android app during development. It’s like Instant Run with a hyperdrive. In case you did not know, JRebel for Android has a Free version as well as an Enterprise version. Today we’ll take a look at the features that come with the Free version. More specifically, how it allows you to speed up your development flow.

JRebel for Android Free features

With the Free version you can use all the core features of JRebel for Android. These include:

  • Instantly update code and resources.
  • Preserve application state.
  • Support for Kotlin, Java, Scala, Groovy languages.

Let us now take a closer look at the first two.

Instantly update code and resources

This feature provides the mechanism to update the application — without having to create and install a new APK every time. Instead, the APK will be built once. All consecutive changes will be delivered as incremental packages. This is very much like an advanced version of Instant Run. After the initial APK creation you’ll see either a cold, warm or a hot swap being used to deliver your changes. As a result, you see your changes faster on the device because:

  • There is less data that needs to be pushed over the ADB (Android Debug Bridge).
  • Only changed code needs to be converted from bytecode to dex.
  • Only the changed dex package needs to go through dex2oat on the device (when developing on a device using Android 5.0 or later).
  • Only the changed Android resources need to be processed/packaged.

Preserved application state

JRebel for Android will keep your application running after applying a change in most cases. Once the incremental change has been transferred to the device, an Activity.recreate() is called. As a result, the activity stack remains the same. Depending on how well you handle onSaveInstanceState(), the state of the current activity also remains the same. During Activity.recreate() all the same lifecycle events are called, as if a configuration change had happened. The most common configuration change you will experience is the orientation flip from landscape to portrait.
Here is an exhaustive list of code and resource changes that will keep your activity stack the same — hence the preserved application state.

  • Modify method body.
  • Add and remove methods.
  • Modify method definitions.
  • Add, remove and modify fields.
  • Add, remove and modify classes.
  • Add, remove and modify annotations.
  • Adding, removing and modifying static fields values.
  • Modify interfaces.
  • Adding and removing enum values.
  • Adding, removing and modifying XML resources.
  • Adding, remove and modify resource IDs.

Let’s also take a look at the most common cases that require an application restart. This primarily occurs when the class hierarchy is changed by:

  • Changing the superclass.
  • Adding or removing an implemented interface.

The next item to cause an application restart is making changes to any Android resources that is directly used by the operating system. For example, making changes to AndroidManifest or to resources linked directly to it.

Debugger

JRebel for Android Free comes with its own debugger. It has the same features and capabilities as the default debugger in your IDE — with the added bonus of being able to apply code changes while the debugger is attached. To start your application with the debugger, press the Debug with JRebel for Android button. Alternatively, you can use the IDE built-in Attach a debugger action, allowing you to connect the debugger to an already running application.

Gradle and build times

Regardless of which JRebel for Android version you pick, there is no configuration or modification needed for your project files. To start using JRebel for Android, download the JRebel for Android plugin from the Android Studio/IntelliJ IDEA plugin repository and hit Run with JRebel for Android!

JRebel for Android Free will also play nice with the latest versions of Gradle and Android Gradle plugins, making sure you get the latest build time optimisations. Your builds with JRebel for Android Free will be incremental and use the standard Java compiler provided by Gradle. If you are interested to learn more about JRebel for Android’s Java incremental compiler, I recommend reading this article.

TL;DR — just the highlights

Did not read the whole thing? It’s fine. Here is the meat of how JRebel for Android Free will save you time and speed up your development flow:

  • Your incremental changes will be delivered immediately to the running application.
  • Application state is preserved — no need to re-navigate the application after each install.

There’s no configuration needed, just install the IDE plugin. You can also check the dedicated JRebel for Android Free page for additional details.


Read next: