TelemetryDeck / KotlinSDK

Kotlin SDK for TelemetryDeck, a privacy-conscious analytics service for apps and websites.
Other
7 stars 6 forks source link

ClassCastException when using layout inspector #23

Closed P-Emmy closed 2 months ago

P-Emmy commented 7 months ago

I can't use the layout inspector in Android Studio (Iguana | 2023.2.1 RC 2) :

java.lang.ClassCastException: kotlin.reflect.jvm.internal.KTypeImpl cannot be cast to kotlin.jvm.internal.TypeReference
at kotlin.jvm.internal.ReflectionFactory.mutableCollectionType(ReflectionFactory.java:107)
at kotlin.jvm.internal.Reflection.mutableCollectionType(Reflection.java:197)
at com.telemetrydeck.sdk.PersistentSignalCache.saveSignals(PersistentSignalCache.kt:69)
at com.telemetrydeck.sdk.PersistentSignalCache.empty(PersistentSignalCache.kt:48)
at com.telemetrydeck.sdk.TelemetryBroadcastTimer$start$1$1.invokeSuspend(TelemetryBroadcastTimer.kt:40)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
kkostov commented 3 months ago

Hello @P-Emmy,

Thank you for reporting this.

It seems the problem occures when the app is attemtping to reset the signal cache on the file system, however I'm having trouble reproducing it in the layout inspector with Android Studio 2024.1.

Would it be possible to share some additional information regarding the project environment like the Kotlin and Gradle versions and the version of TelemetryDeck SDK? Any logcat output you may have handy will also be of great help.

Thanks!

kkostov commented 3 months ago

Hi @P-Emmy, version 2.2.0 of the library was recently released and should help mitigate this problem. If you could test it out, that would be amazing. Thank you!

P-Emmy commented 2 months ago

Hi @kkostov, I don't have the issue with the new version, thanks ;)