

Implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" Implementation "androidx.recyclerview:recyclerview:1.1.0" So we do need that Īll right then next step is we have to add below dependency in app adle. And first of all let’s add internet permission in AndroidManifest that is obvious, Because we are communicating with backend APIs. Let wait for sync of project, that recently you created. Open AndroidStudio and create a new android project with some template. I’m going to focus, this example on coroutines that work with Retrofit and MVVM.Īll right guys, so lets started quickly with this example app. You should know how retrofit works with MVVM. So idea is, I’m not going to details of these, you have to basic idea of these items. Import ., there are some requirements for this retrofit coroutines example app. We set up the utils package exactly the way we set it up in our Our package in the project will look like below, similar to our Since we will be launching the coroutines in the live data scope(we will be discussing this later in this blog), we add the required life cycle dependencies.įor the project, we are going to follow a beginner version of MVVM. Here, we can see that we have added our Retrofit and Coroutines dependencies. Implementation ':kotlinx-coroutines-android:1.3.5'

Implementation '3:logging-interceptor:3.12.0' Implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0' Implementation 'androidx.lifecycle:lifecycle-runtime:2.2.0' Implementation 'androidx.lifecycle:lifecycle-common:2.2.0' Implementation 'androidx.recyclerview:recyclerview:1.1.0' Package name: Īdd the following dependencies in your app level adle. Here, we are going to set up the Android Project. Set up a new project with Kotlin and other dependencies required We strongly recommend you to go through the example project provided inīlog as we are going to improvise on the same in this blog. Before discussing this topic, if you need to refresh the basics of MVVM project, please refer to our We are going to understand these concepts with a project. What is the LiveData scope in Coroutines? How to use retrofit 2.6.0 with coroutines? In this blog we are going to understand with a sample project:

Starting from version 2.6.0 Retrofit supports the concept of “suspend” functions.īefore proceeding further, we would recommend our Also, it keeps updating with the latest trends such as compatibility with Rxjava and now,īlog on Using Retrofit with Koltin Coroutines in Android! The main reason Retrofit is popular among Android Networking libraries is that it reduces a lot of Boilerplate code and helps in consuming the web service easily. One of the most popular libraries used for Networking in Android is Networking is one of the most important parts of Android Applications.
