Top 10 Android libraries on GitHub for faster and cleaner coding

September 4, 2017

There is a number of ready-to-use solutions that can save developers’ time and help create fine-quality products. Especially when you are on a deadline, and looking to build a software package at a fast pace, it may be a brilliant decision to opt for GitHub open source libraries. In this article, we are reviewing top ten Android open source libraries on GitHub that can ease your work greatly. So, let’s start!

Regular open-source Android libraries

Retrofit

Retrofit is a REST client for Android and Java created by Square, which is also a well-known entity for some other great and popular libraries. The latest available version is 2.3.0 with an Apache 2.0 license and a GitHub rating of 22,552 stars.

Some features which make the Retrofit library helpful and easy to use:

  • Work in asynchronous mode, which eliminates unnecessary code
  • Provides you with a robust infrastructure for authentication
  • Comes with a list of ready-to-use convectors and a possibility to create your own one by implementing an interface based on the abstract class Converter.Factory
  • And, furnishes users with error processing and the ability to transfer files

Pros: Lightweight and relatively easy to use, along with clear and exhaustive documentation

Cons: Poor loading images support

Glide

Glide is an open source library which allows you to download and display images, videos and animated GIFs from multiple sources. The library takes care of caching, decoding, connection maintenance, threads, exceptions handling, and much more. Further, its current version is 4.0.0 that is based on license Apache 2.0 and come with a rating of 16,605 stars.

We advise changing default preferences from RGB-555 to ARGB-8888 to get the balance between quality and memory usage.

Pros: Easy-to-use, well-planned, well-documented, excellent memory management, thoroughly tested, animated GIF support, various configurations and customisations options

Cons: Volume comes at 430 kb

Butter Knife

Butter Knife is an open source view injection library which comes in handy to avoid so-called boilerplate code related to the ‘View’ items section in your activities, snippets and holders. This library makes your code uncluttered and readable in a smooth way. The latest version is 8.7.0 along with a GitHub rating of 17,125 stars and the Apache 2.0 license.

Pros: Extremely useful for big and middle-sized projects, helps to write an elegant and clean code

Cons: No support for Pojo Injection

Parceler

Praceler is one more open-source library which can assist you with bulky, repetitive code. Its current version is 1.1.8 along with a Github rating of 2,932 and Apache 2.0 license.

Parcelables are a fast way to serialise and deserialise objects, but as a result, we get a ton of boilerplate code. To avoid that, just use Parceler library, and you will get a clean code without the necessity to implement the Parcelable interface.

Pros: Creates parcelable code automatically

Cons: No possibility to implement RealmList by default

LeakCanary

One more effective instrument created by Square to detect and handle with memory leaks in your code. It currently comes in version 1.5.1 with a rating of 16,013 stars and Apache 2.0 license.

One single line of the LeakCanary code is enough to detect a memory leakage! It is really astonishing the library is able to lessen memory loss up to 94 percent!

Pros: Detects and prevents memory leakages greatly and easy to use

Cons: False positives sometimes occur

Robolectric

The Robolectric framework allows you to write and run tests for Android applications on a local JVM, with the help of the Android API. Yes, that’s right, you do not have to wait until apk is loaded and installed, and the application on the phone starts. Just press “start” and JVM will run all the tests quickly. The Android environment is emulated, and there is access to all the core functionality. We advise using this open-source library to test business objects, application logic, data storage and processing.

Pros: No need for emulators or devices to run tests and quick performance

Cons: A device or an emulator is needed to perform UI testing

Advanced level Android open-source libraries

Now let’s see which libraries are popular among sophisticated developers. We bet many of them will become your favorite too!

Dragger 2

The more extensive your project is, the more dependencies it may have. Dragger 2 is the best when it comes to handling with dependencies in a massive project. Its fundamental merit is that it works on the principle of code generation without reflection. Therefore, any errors related to the construction of the dependency graphs will be found during the project compilation.

By implementing DI (Dependency Injection) in our project, you can beautifully get rid of the strong connectivity between the various modules of your application. Also, you can remove most singletons, which usage was unjustified. The library allows to write and edit code faster and more efficiently. Also, it simplifies the Unit and UI tests, which guarantees a higher stability of your application.

The current Dragger 2 version is 2.11 along with the GitHub rating of 7,825 stars and Apache 2.0 license.

Pros: Generate qualitative code faster, handle multiple dependencies easily and comes in lightweight

 

RxJava

RxJava library will be of great help in compilation and processing event sequences in reactive programming. The library may be a bit complicated for those who are used to the imperative programming, but you will appreciate Rx programming and the library after you clear it up.

The latest RxJava version is 2.1.1 with a GitHub rating of 25,885 stars and Apache 2.0 license.

Pros: Helps to deal with asynchronous operations, different types of threads and cuts down the number of state variables which makes your code much more comprehensible

Cons: Hard for beginners

EventBus

EventBus can assist to simplify communication between different parts of your Android app. For instance, you can send something from an activity to the running service. Comparing to other tools for this task, the library can send any data in any volume without its serialisation. And EventBus also deals with async threads.

The current version of EventBus is 3.0.0, while its GitHub rating is 15,311. The project is licensed under Apache 2.0.

Pros: Lightweight, efficient and deals greatly with its main task

Cons: Can make your code incomprehensible

Retrolambda

Retrolambda is an open-source repository that allows shortening the amount of code associated with the creation of anonymous internal classes, using the laconic lambda syntax. The library applies to Java 6, 5 and 7 and is currently available in version 3.7.0. It comes with a rating of 4,893 stars on GitHub and is licensed under Apache 2.0.

Pros: Provides with the backporting support and includes Gradle plugin

Cons: Does not allow to backport the new Java 8 APIs

How to choose the right GitHub open source library for your needs?

If you are new to open-source repositories, you still will not be lost because the Internet is full of articles, blogs and communities to follow and get some accurate directions. You can access repository platforms such as GitHub, Programmer Fellow, and StackOverflow to begin with your development.