reactivedroid / TvFlix

TvFlix android app using Dagger Hilt, Coroutines, Flow, KTX, Jetpack(Room, ViewModel, Paging3, Lifecycle) based on MVVM with clean code architecture purely written in Kotlin
https://reactivedroid.github.io/TvFlix/
MIT License
412 stars 57 forks source link

API 18 device crash immediately when launching app #9

Closed Buzzfease closed 4 years ago

Buzzfease commented 4 years ago

launching app with api 18 device got crash immediately, but no problem running with device with api 21 or higher

com.android.tvmaze.dev.debug E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher java.lang.NoClassDefFoundError: java.util.Objects at okhttp3.Address.hashCode(Address.kt:180) at okhttp3.Route.hashCode(Route.kt:84) at java.util.HashMap.containsKey(HashMap.java:332) at java.util.HashSet.contains(HashSet.java:138) at okhttp3.internal.connection.RouteDatabase.shouldPostpone(RouteDatabase.kt:40) at okhttp3.internal.connection.RouteSelector.next(RouteSelector.kt:74)

Seems like MultiDex problem, MultiDex under api 21 and code under heavy dependicy likely cause this kind of problem. create multiDexKeepFile and multiDexKeepProguard maybe help.

reactivedroid commented 4 years ago

This crash was happening since the okhttp 4.x has stopped supporting devices below API 21. Increased the minSdkVersion to 21 now