Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INFO] About Retrofit and RxJava Latest Versions #2

Open
sebetci opened this issue Jul 4, 2022 · 0 comments
Open

[INFO] About Retrofit and RxJava Latest Versions #2

sebetci opened this issue Jul 4, 2022 · 0 comments

Comments

@sebetci
Copy link

sebetci commented Jul 4, 2022

1. Info

I found out that the major version of the RxJava library has been upgraded to v3. That's why I opened this issue. The dependencies (build.gradle (:app)) I use in the current project are as follows:

dependencies {
    ...

    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'

    implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
    implementation 'io.reactivex.rxjava3:rxjava:3.0.0'

    implementation 'androidx.recyclerview:recyclerview:1.2.1'
}

In this case, the assignment (.addCallAdapterFactory(RxJava3CallAdapterFactory.create())) to the retrofit object in the onCreate() method in MainActivity.java should be updated:

public class MainActivity extends AppCompatActivity {
    ...

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    ...

        retrofit = new Retrofit.Builder()
                .baseUrl(baseURL)
                .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }
}

2. Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant