Android App Using MVP+RxJava 2+Dagger 2+Retrofit 2 And More. Part I.

Start a New Android Project

Use Android Studio New Project Dialog. Pick any Activity that you think will be useful . Blank , NavDrawer etc.

What are we going to do

We will be making a shopping app complete with Login , Checkouts , Products Display , so on. Let's see how far can we go here.

What will we be using?

RxJava2 . The standard for reactive and Asynchronous applications.

Dagger2 The Dependency Injection Library . Makes code decoupled and highly testable.

Retrofit Turns API into Java Interfaces.

MVP Model View Presenter , the Architecture that we will be using to organize everything . Seperating Business Logics from other Elements such as UI is very Important.

More as we go forward . Such as Firebase , SQLites , Push Notifications etc.

Installation

Lets add the dependencies in gradle that we haven't yet added. These are all the latest and Stable Dependency-Library that we have.

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
dependencies
{
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    //OkHttp
    compile 'com.squareup.okhttp3:okhttp:3.5.0'
    compile 'com.squareup.okio:okio:1.11.0'
    //Gson
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    // apt command comes from the android-apt plugin
    Dagger2 Generates code that is not recognised by AS(Android Studio)
    apt 'com.google.dagger:dagger-compiler:2.7'
    compile 'com.google.dagger:dagger:2.7'
    provided 'javax.annotation:jsr250-api:1.0'

    //RxJava2
    compile 'io.reactivex.rxjava2:rxjava:2.0.2'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'

}

In the Project level Dependency Gradle add. classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

In the next part we will be using introducing ourselves to MVC. Design the packages into proper parts and functions.

Previous Post Next Post