Java.lang.NoClassDefFoundError: io.reactivex.Observable

When I use Observable in my updated API on a phone with API 21, I got this error:

java.lang.NoClassDefFoundError: io.reactivex.Observable 

but on the phone with API 19 or an emulator with API 23 it works.

This is my API:

 import io.reactivex.Observable; import retrofit2.Response; import retrofit2.http.Body; import retrofit2.http.POST; public interface ApiService { /** * Created by Mohsen on 5/10/2017. * */ @POST("/cp/api/") Observable<Response<Integer>> Get_BuyBox_Count(@Body Object request); } 

and this is my Retrofit setting:

  @Provides @Application_Scope @Store_Retrofit_Qualifier public Retrofit Store_retrofit(OkHttpClient client) { return new Retrofit.Builder() .baseUrl(Urls.Sotre_Base_Url) .client(client) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(JSONConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build(); } 

my dependencies:

  compile 'com.squareup.retrofit2:retrofit:2.2.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' compile 'io.reactivex.rxjava2:rxjava:2.0.1' compile 'io.reactivex.rxjava2:rxandroid:2.0.1' compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' 
+5
source share
1 answer

Finally, after I found a solution.

problem conflicts with Rxjava with Constrainlayout

 compile 'com.android.support.constraint:constraint-layout:1.0.2' 

with

 compile 'io.reactivex:rxjava:1.2.6' 
+3
source

Source: https://habr.com/ru/post/1268423/


All Articles