Click here to Skip to main content
13,798,257 members
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.4K views
6 bookmarked
Posted 23 Jan 2018
Licenced CPOL

7 Android Libraries Every Developer Should Know About

, 23 Jan 2018
Rate this:
Please Sign up or sign in to vote.
‍In this article am sharing with you 7 Android libraries every developer should use to enhance the application from different perspectives. When developing in Android, usually you have to deal … . The post 7 Android Libraries Every Developer Should Know About appeared first on Coding Sonata..

‍In this article am sharing with you 7 Android libraries every developer should use to enhance the application from different perspectives.

When developing in Android, usually you have to deal with several requirements, such as doing restful Api calls, data serialization, loading and processing images as well as development related matters like project structure, optimizations, logging and more.

Dealing with such problems usually require a huge amount of time if you are willing to write your own implementations manually.

But why reinvent the wheel?

There are already tens of great free open source Android libraries, in which the open source community people already spent tons of hours developing and contributing to these projects to come up with robust, useful and almost bug free android libraries to be helpful for all the developers worldwide.

And they spend even more time supporting and solving the raised issues.

You will definitely notice a dramatic improvement in your code quality, application performance and development productivity after you learn and start using the libraries I am mentioning in this article.

So here are the 7 Android Libraries unveiled:

 

Gson

gson android libraries

The super lightweight library to manipulate JSON Objects inside Java. It provides super easy methods to serialize and deserialize Java objects to and from JSON

Gson plays well with Java Generics and can be used with both Java models from your application module, or 3rd party libraries.

Gson mainly provides 2 methods fromJson() , and toJson() . The former converts a Json string to a Java model as provided in the method’s second parameter type. The latter does the inverse, it converts the given Java model to a Json string.

To start using Gson in your Android code, you only need to include it into your build.gradle file as below:

dependencies{
compile 'com.google.code.gson:gson:2.8.2'
}

To learn more about Gson library and its features, with sample code and Api guide, press here.

 

Dagger

dagger2 android libraries

This is best library to implement the Dependency Injection (DI) pattern into your application.

There are already other android libraries that can help you achieve the DI pattern like Robo Guice (Deprecated as of August 2016), Butter Knife or Android annotations. Each of these has its pros and cons.

And in my opinion, I see that Google’s Dagger version 2 , provides the best option when it comes to implementing a robust and well-structured dependency injection pattern.

Previously, there have been 2 versions of dagger library from both Square Inc. and Google.

Square’s version of Dagger 1.x is now deprecated and no longer maintained.

Google has built on top of Dagger 1 and is now maintaining Dagger 2, which brings a great development and performance improvement on the framework, with a compile-time validation of the object graph, full trace-ability, easy debugging of provision and creation and more improvements.

To use Dagger 2 in gradle:

// Add Dagger dependencies
dependencies {
  compile 'com.google.dagger:dagger:2.x'
  annotationProcessor 'com.google.dagger:dagger-compiler:2.x'
  compile 'com.google.dagger:dagger-android-support:2.x' //if you use support libraries
}

This only reveals the tip of the Dagger 2 iceberg,  there is a lot to learn about this great library. You can start from here.

 

Retrofit

retrofit2 android libraries

The most convenient way to do http(s)-based Restful API calls. Retrofit is a type-safe Http Client that is built on top of OkHttp library.

It provides an easy and simple way to introduce your API endpoints using attributes that should be defined inside a Java Interface, and then you instantiate the Retrofit instance with its builder method, after that you implement the method call, and attach a callback object, which will override 2 standard methods: onResponse , and onFailure

Retrofit gives you the ability to modify the header objects of the request, add interceptor for the request chain, implement custom authenticator and custom model converter factory.

To start using Retrofit, first you need to include library reference in your build.gradle file:

dependencies {
compile 'com.squareup.retrofit2:retrofit:2.3.0'
}

<br />
Check Retrofit website to continue learning.

 

Android Ion Library

ion android libraries

Android Asynchronous Networking and Image Loading, Ion provides you a fluent API code to do a set of asynchronous tasks related to API calls, downloading files, loading images into ImageView.

All ion operations return Future Object and can be gracefully cancelled.

In fact, Ion combines the features of multiple android libraries into one. It is a great way to achieve the tasks of doing asynchronous api calls, loading images, downloading files, cancelling requests and many more.

To use Ion library, add a reference to it as the below:

dependencies {
compile 'com.koushikdutta.ion:ion:2.+'
}

If you are interested in learning more about Ion Library, check its GitHub Repository

 

Crashlytics

crashlytics android libraries

A product of fabric.io which was acquired by Google since January, 2017.

Crashlytics is the ultimate crash reporting and monitoring tool.

The administration web portal provides comprehensive information about crashes and users. It provides a real-time view of crashes, with a full deobfuscated stack trace of the crash, the device type, OS version. It also gives geographical information about the user who had the crash.

To integrate Crashlytics inside your app, there is an Android studio plugin for fabric that can be installed.

To install the Fabric plugin, go to File -> Settings -> Plugins , and then in the search bar type ‘Fabric’ , you will get the option ‘Fabric for Android Studio’ , then choose ‘install’ , and follow the instructions afterwards.

Once done , you will start seeing a Fabric tab view in your Android studio, from there press ‘sign up’ to create a new fabric account, it will take you to fabric.io account creation page, from there input the account details you want, then finish the setup.

Once you confirm your account, enter your credentials into Android studio fabric view, and then from the products list, choose Crashlytics.

Follow the on-screen instructions to finish integrating your android app with Crashlytics.

For more details, installation instructions, and code examples, check fabric.io website.

 

Picasso

picasso android libraries

Instead of loading an image directly into an ImageView, why not do it asynchronously?

Picasso gives you the option to download an image from a url and then display it into the ImageView without you having to block the UI while waiting for the image to get downloaded, the ImageView itself will display a small loading spinner, and once the image gets ready, it displays it seamlessly.

Picasso also features adapter downloads, image simple and custom transformations, download and error placeholders and more.

To use Picasso library, just include it in your gradle’s dependencies section:

dependencies {
compile 'com.squareup.picasso:picasso:2.5.2'
}

To learn more about Picasso, check this link

 

Robolectric

robolectric android libraries

A unit testing framework that enables running the unit tests inside JVM instead of running them on emulator or real device.

Robolectric tests can handle many native operations such as view inflation and resource loading, that you cannot achieve with normal JUnit tests, so this gives you a near experience of testing on a real device or an emulator.

To start writing Robolectric unit tests, you first need to include the Robolectric library into your gradle file.

If you are using Android Studio 3 Alpha 5 version or higher, you will need to include the resources merging as part of your gradle test options alongside with referencing the library itself.

testImplementation "org.robolectric:robolectric:3.6.1"

android {
  testOptions {
    unitTests {
      includeAndroidResources = true
    }
  }
}

Annotate your test with the Robolectric test runner:

@RunWith(RobolectricTestRunner.class)
public class AccountActivityTest {
}

See Robolectric.org for a complete guide to learn more about this industry-standard unit testing framework.

Conclusion

You need always to focus on delivering quality android apps in timely manner. The digital age is already fast forwarding and everyday there are hundreds of apps being pushed to Google Play store.

The challenge is growing and the urge to have fast paced iterations of app development is significantly rising.

To be able to catch up with the digital transformations’ high-speed train, you need to be a proactive developer, which means you should always keep on the look for the best android libraries and tools that will improve your productivity and enhance the app development experience.

Make sure to choose your tools, SDKs and libraries wisely.

I recommend that you also read my article of 9 Bulletproof ways to become a better developer.

This is a comprehensive article about all the things you can do to improve your technical skills and become better and proactive developer.

I have included 7 of the most essential and useful android libraries for developers to learn and use .

I might be missing some more important libraries , please share it in a comment so all of us can learn from each other.

 

Bonus

For this important topic , I would like to share this captivating music which is

“Water Music – Suite number 2 in D major. Movement 12”  by George Frideric Handel

Enjoy it 🙂

 

 

The post 7 Android Libraries Every Developer Should Know About appeared first on Coding Sonata.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Aram Tchekrekjian
Technical Lead
Jordan Jordan
My name is Aram Tchekrekjian, I’m a passionate software developer with 7+ years of overall experience in various development languages including vb.net, c#, java and some php, during which I gained abundant of knowledge in Asp.net Web Forms, Asp.net Web Api, javascript, bootstrap, entity framework, WCF, windows forms, SQL server, MySQL as well as Android.

Currently I am an android developer and a scrum master within a cross-location teams working on multi-platform project, managing a Jenkins CI for multiple projects on an ubuntu server. My main interests are: git, docker, SEO, digital marketing.

I work as a Corporate Technical Lead in the Digital Solutions Team at Aramex International in Amman, Jordan.


You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralMy vote of 5 Pin
Jay Bardeleben30-Jan-18 7:10
professionalJay Bardeleben30-Jan-18 7:10 
Question7 Android Libraries Every Developer Should Know About Pin
Member 1363868823-Jan-18 1:10
memberMember 1363868823-Jan-18 1:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.181207.3 | Last Updated 23 Jan 2018
Article Copyright 2018 by Aram Tchekrekjian
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid