We’re excited to announce that JRebel For Android 2.0 has landed! If you’re as sick of slow development as we are, click below to check out the latest version of our awesome Android dev tool.
This post was modified from its original version, we’ve rewritten it to be more precise and updated it with the fresh information.
This blog post takes a look at seven Android libraries which Java developers should at least know about. Also, it’s a useful post for Android developers to be aware of too, just in case there are some Android libraries you may not be aware of.
Android & Java both have quite similar APIs. In fact, they’re so similar that some time ago Oracle sued Google for violating patents, but we’re not going to get into that here, you’ll be pleased to know. Naturally, the benefit of Android & Java’s APIs being similar is that it makes it possible to develop frameworks and libraries that work on both platforms. That enabled developers to create libraries and tools that can work on both platforms.
Dagger is a lightweight dependency injection with no extra bells and whistles. It is probably the most known and used dependency injection library on Android. It is a simple and fast dependency injector for both Android and Java. It has two pieces: the Dagger library (100kb of size) and the Dagger compiler.
The library contains all the necessary logic and some annotations. It also uses standard javax.inject annotations, making your code portable between different dependency injection frameworks like Spring or Guice. Dagger is one of the simplest and most lightweight DI frameworks. It doesn’t contain all the fancy features provided by larger frameworks but it is fast, and it does its job. It’s worth considering for when you want to use plain dependency injection with nothing else.
Dagger is licensed under Apache License 2.0, development is led by Square & Google and it can be found here: http://square.github.io/dagger/.
Did you know that coal miners used to take a canary in a cage down the mines so that if the gas got so bad that the canary died, it would be their signal to leave the mine. Well, LeakCanary is similar, but instead of testing for gas leaks, it’s a memory leak detection library for Android and Java. It helps to detect easily leaking objects by just adding a couple of lines of Java code to your existing code. It’s free and very easy to use. Similar to Dagger, the development of LeakCanary is also led by Square.
Again, LeakCanary is licensed under Apache License 2.0 and can be found from https://github.com/square/leakcanary.
Using Barcodes and QR codes has become a standard already in the machine-readable data world. ZXing has been around for a while. Originally written in Java, it can read and create barcodes on many platforms, and it has been ported to many different languages. The library has been around for a while and has a good user base. The QR-code reader you are using in your smartphone is probably using this library. It works well and has a good history.
ZXing is developed by Sean Oven, Daniel Switkin, ZXing Team and it is licensed under Apache License 2.0. It can be found from here: https://github.com/zxing/zxing.
Retrofit is another library developed by Square! These guys are pretty good at writing Android libraries, aren’t they! Retrofit is a library that can turn your REST API into a Java interface. It is a type-safe REST client for both Android and Java. Retrofit enables you to write nice code in pure Java for communication with almost any RESTful API. Like Android libraries tend to be – a lightweight and relatively easy to use.
The development of Retrofit is led by Square and it is licensed under Apache License 2.0. You can find more information about it here: http://square.github.io/retrofit/
We’ve played with Retrofit 2 to understand the API better and get a grip on how the library behaves. If you’re interested, check out our getting started with Retrofit 2 post.
When it comes to parsing and formatting phone numbers, there aren’t many good and free solutions available to the developer. Thankfully, the Google team has come up with a library called Libphonenumber. It is probably the best and most comprehensive library for parsing, validating and formatting phone numbers. Other than the name, which doesn’t roll off the tongue, it’s great!
It has a quite simple and easy to use API and has also been ported to other languages off the JVM such as C# and PHP. The development of Libphonenumber is led by Google, and it is licensed under the Apache License 2.0. For downloads, navigate here: https://github.com/googlei18n/libphonenumber
While not a library, JRebel for Android is a development tool from the ZeroTurnaround team that eliminates the build, install and run phases of your development. This enables you to develop your code and see your changes live in your emulators or on your devices.
Here’s another library from our friends at Square. Tape is just a collection of classes for queue handling. It’s great for handling data streams and downloading data in unstable environments. Rather than code a load of the queue-handling work manually, Tape takes care of it for you. If something fails, then Tape automatically retries run the command or operation again. Also, all intermediate results can be automatically cached, which is a useful feature too.
The kind folks at Square have again licenced the project under an Apache License 2.0, which you can find here: https://github.com/square/tape
The Jitpack.io is developed by the team at Streametry Ltd. Jitpack can build any Github project off the hook and publish it to the public Maven repo. How cool is that? It will help save time and hassle when building dependencies. It is one of the easiest ways to publish any Github project as a Maven dependency.
You can check you Jitpack here: http://jitpack.io/. Jitpack uses a custom terms of usage license.
As we can see from the examples above, most of the new Android libraries and tools available are indicating a need for lightweight and simpler libraries that work in unstable environments which everyone can use. There is also a little confusion between Android & Java, where things are ported from Android to Java and vice versa but if you can write something that works on both, then why not do it? :)
Also, don’t forget JRebel for Android! You can try it for free in a trial, so there’s nothing to lose in giving it a go. Click the button below to take the first step in your journey of amazement!
Let me know which libraries in the list were new to you and if you found them useful. Also, if there are any libraries you think I missed which are essential reading for Java and Android developers, let me know in the comments below!