Matt Kula
09/20/2021, 7:47 PM1.5.10
to 1.5.21
, I am seeing this crash my app at runtime:
09-20 12:41:05.002 8656 8882 E AndroidRuntime: java.lang.NoSuchFieldError: No instance field value of type Ljava/lang/Number; in class Lcom/apollographql/apollo/api/CustomTypeValue$GraphQLNumber; or its superclasses (declaration of 'com.apollographql.apollo.api.CustomTypeValue$GraphQLNumber' appears in /data/app/~~v-sB5aGo_MrIlzyI7ulTjA==/com.theathletic.dev.debug-03h-0mOhbaZBD9VCVDnqoA==/base.apk)
09-20 12:41:05.002 8656 8882 E AndroidRuntime: at com.theathletic.injection.TimestampAdapterKt$timestampAdapter$1.decode(TimestampAdapter.kt:8)
09-20 12:41:05.002 8656 8882 E AndroidRuntime: at com.theathletic.injection.TimestampAdapterKt$timestampAdapter$1.decode(TimestampAdapter.kt:6)
09-20 12:41:05.002 8656 8882 E AndroidRuntime: at com.apollographql.apollo.internal.response.RealResponseReader.readCustomType(RealResponseReader.kt:163)
09-20 12:41:05.002 8656 8882 E AndroidRuntime: at com.theathletic.fragment.FeedGame$Companion.invoke(FeedGame.kt:131)
09-20 12:41:05.002 8656 8882 E AndroidRuntime: at com.theathletic.fragment.Consumable$Consumable1$Fragments$Companion$invoke$1$feedGame$1.invoke(Consumable.kt:237)
09-20 12:41:05.002 8656 8882 E AndroidRuntime: at com.theathletic.fragment.Consumable$Consumable1$Fragments$Companion$invoke$1$feedGame$1.invoke(Consumable.kt:236)
Here is my adapter that it's trying to invoke:
val timestampAdapter = object : CustomTypeAdapter<Long> {
override fun decode(value: CustomTypeValue<*>) =
(value as? CustomTypeValue.GraphQLNumber)?.value?.toLong() ?: 0L
override fun encode(value: Long) = CustomTypeValue.fromRawValue(value)
}
This is on a develop build that has not gone through R8. Our apollo stuff is put into its own module, but I have tried clearing all caches and rebuilding from scratch and am still seeing the crash.