Diya Tech Lab Blog

23
Sep - 2017

Top 10 Android Libraries that every Developer should know

saloniparikh

Hey guys , we are back with the new tutorial. This tutorial is all about Top 10 Android libraries that you should know and use it in your Application. Developer and beginners both uses different third-party libraries but sometimes you don’t no the perfect usage of library or sometimes you are not aware about existence of libraries that makes your Application easy to use. So let’s start with some of the libraries that may helps you.

Retrofit

Retrofit is a type-safe REST FULL client for android build by Square. You can download the Json or xml data from Web. You can use ant server like  local host (Wamp or Xamp) or Live server to use and get Json or xml data.

You needed to 2 classes

  1. POJO or Model class (used to retrieve the data from the JSON returned by the  server)
  2. Interface
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public interface RetrofitInterface {

// asynchronously with a callback

@GET("/api/user")

User getUser(@Query("user_id") int userId, Callback<User> callback);

// synchronously

@POST("/api/user/register")

User registerUser(@Body User user);

}

By default Retrofit uses Gson.

More details about retrofit you can get from

https://github.com/square/retrofit

Universal Image Loader

Universal Image Loader is one of the library for loading Images. Its open source Library that makes your development more easily and faster. It loads multiple images asynchronously. It Loads , cache(memory or SD card) and display the images. You can say its alternative are Picasso and volley.

more details you can find and use from

https://github.com/nostra13/Android-Universal-Image-Loader

OkHttp

OkHttp is a open source library that is very efficient HTTP. OkHttp perseveres when the network is troublesome . It has multiple IP address, so incase of any connection problem with IP it will connect with an alternative address.

okHttp library allows:
⦁ HTTP/2 support
⦁ Connection pooling
⦁ Shrinks download sizes
⦁ Response caching

https://github.com/square/okhttp

EventBus

EventBus is open Source library that simplifies the communication between different parts of android application. It avoids complex and error-prone dependencies and life cycle issues and performs well with Activities , Fragments and background threads. It makes your code simpler and fast.

https://github.com/greenrobot/EventBus

ActiveAndroid

ActiveAndroid is an Android library which allows performing SQLite database operation without writing single SQL statement. It is an ORM(Object Relational Mapping).

https://github.com/pardom/ActiveAndroid

or

https://github.com/pardom/ActiveAndroid/downloads

Gson

Gson is a Java library used for serializing and deserializing different Java objects from and into JSON. It is used in Retrofit. It provides easy to use methods and allow custom representation of objects.

https://github.com/google/gson

Butter knife

Butter knife is a light weight library to inject views into Android components. It uses annotation processing. This library makes your code uncluttered and readable in a smooth way. Bind arbitrary objects using an activity as the view root.

https://github.com/MatthiasRobbers/butterknife

https://github.com/avast/android-butterknife-zelezny

https://github.com/JakeWharton/butterknife

Leak Canary

Leak canary library is used to detect and handle memory leaks in code. The memory leak can be a headache to detect and to resolve, small memory leaks can be hidden and may be seen after a long usage of the application and hunting memory leaks is not a simple task. It Detects and prevents memory leakages greatly and easy to use.

more details you can see from this link

https://github.com/square/leakcanary

ActionBarSherlock

ActionBarSherLock is an extension of the Support library designed to facilitate the use of the action bar design pattern across all versions of android with single api use this link for more details

https://github.com/JakeWharton/ActionBarSherlock

and also you can use this link to get more knowledge about actionbarsherlock

http://actionbarsherlock.com

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.so , you donot have to wait untill apk is loaded and installed, Application of phone starts. An alternate approach to Robolectric is to use mock frameworks such as Mockito or to mock out the Android SDK.

https://github.com/robolectric/robolectric

https://github.com/mutexkid/android-studio-robolectric-example

about robolectric

https://github.com/robolectric