2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Kotlinで「error:java.lang.IllegalArgumentException: Unable to create call adapter for io.reactivex.Observable」というエラーがでるようになったら

Last updated at Posted at 2019-02-20

Androidアプリのアプデで、下記エラーに遭遇。(いままで動いていた

logcat
2019-02-20 10:20:50.638 26755-26954/hogehogehoge E/MainActivity: error:java.lang.IllegalArgumentException: Unable to create call adapter for io.reactivex.Observable<hogehogehoge.hoge.model.Api$CalculatorJson>
        for method CalculatorService.json

build.gradleの

build.gradle
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'

implementation 'com.squareup.retrofit2:adapter-rxjava:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'

に変更し、Sync。

Api.kt
val adapter = Retrofit.Builder()
        .client(client)
        .baseUrl("https://cdn.cgate.jp")
//        .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
        .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
        .addConverterFactory(GsonConverterFactory.create(aaa))
        .build()

RxJava2CallAdapterFactory に差し替え

これで、無事解決しました。
メモメモ。
Kotlin今日ハジメテ触ったばかりで全然理解できていないですが、
swiftっぽくていいかも。

参考にさせて頂いたサイト

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?