The latest expert opinions, articles, and guides for the Java professional.
We recently released JRebel for Android 1.0. The feedback from the community has been great and we are working hard on delivering even more value for all users. Today we are excited to reveal a few features that we have been tinkering with since the release.
Gradle integration made easier
JRebel for Android integration with Gradle previously required a couple of extra lines in the build.gradle files. We have since changed the way we interface with Gradle — to remove the need for these lines altogether. This means that JRebel for Android does not require any changes to your project files.
This also provides an opportunity for new nice things. We now have a neat little progress bar in the IDE, indicating that JRebel for Android is doing its thing. We have also improved build times — since Gradle no longer needs to check for the JRebel for Android Gradle plugin updates. All this paves the way toward adding IntelliJ IDEA support.
These features will be rolling out to all users over the coming weeks.
Incremental Java compilation
There is a shortcoming concerning Java compilation in Gradle. Whenever a single .java source file changes, all sources have to be recompiled. This affects JRebel for Android, as it operates on Java bytecode level and relies on Gradle for the compilation.
For smaller apps this is not a huge problem, as the Java compilation takes less than a few seconds. We are aware that for larger codebases, this step can last 20 seconds or more. As luck would have it, Gradle actually does provide a form of incremental Java compilation.
We experimented with enabling this for JRebel for Android builds. While it works reasonably well, it has a few caveats:
- There is no support for annotation processors like Butter Knife or Dagger.
- The dependency analysis is based on bytecode, not the Java source code. This means that changing any class with “public static final” fields triggers a full recompilation of the entire source tree (since values of these fields get inlined into other classes without the dependency analyzer being able to detect it).
- Kotlin does not work well with incremental Java compilation (and possibly other, alternative JVM languages).
For these reasons, we have not enabled this option for all users. We probably will not be doing so until we can solve at least some of the issues mentioned. However, if you are feeling adventurous and want to give this a go — read on!
The experimental flag
We update JRebel for Android quite often, usually at least once a week. This allows us to get bug fixes into the hands of the users as quickly as possible. To make sure that any incomplete or experimental features do not adversely affect the experience, we hide them behind feature toggles. This allows us to roll out a feature to a subset of users, validate that everything works well and then ship the feature to more users.
We have added a special feature flag to our Android Studio plugin that enables these experimental features. At this moment (JRebel for Android version 1.0.10), enabling this flag will activate both the new Gradle integration (no need for additional JRebel for Android configuration lines in the build files) and the incremental Java compilation when applying changes. If you do not mind trying out the bleeding edge of our software, you can give this a go by doing the following:
- Make sure that you are running JRebel for Android to 1.0.10 or newer (visible at launch).
- Locate or create your studio.vmoptions file, as described here.
- Add the following line to the studio.vmoptions file: -Djrebel.android.experimental=true
- Restart your Android Studio!
We are excited to share these features with you. Please do note that the experimental features are very early, having nearly a borderline alpha quality. If you experience any issues, do not hesitate to let us know. Your feedback is always welcome. Just open Tools > JRebel for Android > Send feedback in the IDE or send us email directly at firstname.lastname@example.org.
JRebel for Android allows you to update code and resources instantly. This will save you hours during the day waiting for the build to complete. Get the free 21-day trial today.
No comments yet.
Leave a comment