If you develop an Android application, then you should know that a good developer never reinvents the wheel. You have many open source libraries which help you to write powerful applications. In this article is listed a selection of our favorites ones, which we commonly use in our projects.
Dependency injection is a design pattern useful when we have an object which uses another object to do something. Instead of creating the needed object in our object, we pass it into the constructor or we can use the property setters.
Dagger is a fast dependency injector designed for low-end devices. You can use this library not only for testing. It also makes it easy to create reusable modules or change them in the same app. Dagger is less powerful than other dependency injections, but it’s the most efficient.
Gson is a Java library developed by Google, used to serialize and deserialize Java Objects from and into JSON. If your application has to communicate with an APIs then you need this library. Almost all the REST API use JSON because it’s lightweight and much more simple than XML.
Retrofit is another awesome and very useful library which transforms the communication with the API into a child’s play. It’s incredibly easy to GET data from API and parse it into a POJO. Obviously, with Retrofit you can also do POST or other request types as easily as GET. Also, there are two types of calls, synchronous and asynchronous.
In conclusion Retrofit will make life better for you and other developers who will read your code.
Until now I've talked about libraries which help us get data from remote location, but what we will use if we want to display remote images? Fortunately, we have
Picasso, an amazing library for downloading, displaying and caching images on Android. Picasso handles every stage of the process, from the initial requests to the caching, recycling and displaying the final bitmap into the target view.
Also you can use Picasso to resize the images and the result will also be cached. This means the images will be downloaded and transformed one time and just displayed on future use.
OkHttp is an efficient HTTP+SPDY client which makes your application load faster the data and media from cloud storage and saves bandwidth. The usage of this library is very simple and reduces the amount of code.
Every powerful Android application must have an automatic testing module. I know many developers manually test their application on the emulator or the device, but this process is very slow.
Robolectric is a unit test framework to run tests inside the JVM, not in the emulator. Using it will not only reduce the time taken to develop the application, but also the application can be included in Continuous Integration for testing all the environment.
Until now I’ve presented you the most useful libraries which help us develop Android application faster, but to also have a powerful application we need at least one of the next platforms:
Parse provides a backend cloud service with all features you need, from storing your data app to analytics and push notifications. It’s easy to use it and the database structure is very flexible. About the price, Parse has a free plan which is perfect for start-up or prototype applications.
Before release, every application must have Closed Beta version which will be used by a restricted group of invited individuals for a user test. Using
TestFairy has never been easier to know what exactly was tested and what went wrong. TestFairy provides a video of the exact steps that were done, but also details about CPU, Memory, Network and a lot more. To use this service you don’t need to change your code or to implement any SDK. You just upload your application and all the changes are made in real time on the TestFairy platform.
Crashlytics is the most powerful real-time crash reporting for mobile applications. Any mobile app can crash in production, although it was tested by specialized testers and/or using unit testing. So, our main goal is to minimize this risk, find the issue and fix it as soon as possible. Using Crashlytics we are notified every time an application crashes and shows us exactly what part of the code caused the crash. To implement the Crashlytics SDK in your app is quite simple compared to the benefits that it brings.
Something happened that you did not expect, it is better to be prepared!