DZone

Retrofit is a REST API Client for Java.
It is developed by Square Inc. and uses OkHttp library for HTTP Request. It is a simple library that is used for network transaction.
It is a very easy and fast library to retrieve and upload the data via Rest based web service.

Adding Dependency in Build.gradle

dependencies {
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.google.code.gson:gson:2.6.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
}

Adding Internet Permission in Manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.kripashankar.countryappusingretrofit">
    <uses-permission android:name="android.permission.INTERNET" />

Retrofit mainly need three things which are following-

Source: DZone