LoginSignup
9
2

More than 5 years have passed since last update.

Kotlin Coroutines 1.3とRetrofit2を使うとAPIを叩いた瞬間にクラッシュする

Posted at

Kotlin Coroutines 1.3 と Retrofit2を一緒に使った時にアプリ起動時にクラッシュしましたのでメモとして残しておきます。

解決法

retrofit2-kotlin-coroutines-adapter のライブラリがKotlin Coroutines 1.3に対応したものを導入する必要があるようです。

  • 変更前
// coroutines
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-experimental-adapter:1.0.0'

  • 変更後
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

に変更すれば直ります。

原因

おそらくKotlin Coroutines 1.3 からパッケージ構成が変わったようでその対応ができてないだけかと思います。
現在(2018/Pull Requestもあげってますのでもう少ししたらマージされるはずです。

9
2
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
9
2