MobileNativeFoundation / Store

A Kotlin Multiplatform library for building network-resilient applications
https://mobilenativefoundation.github.io/Store/
Apache License 2.0
3.16k stars 197 forks source link

[BUG] Kermit version problem #653

Open ndiazgranados opened 1 month ago

ndiazgranados commented 1 month ago

i have an app in kotlin multiplatform, but when im trying to use store I receive an error due to kermit (I have also a dependency of kermit in my project specific 2.0.4) so I have this code in a repository

    private val store by lazy {
        StoreBuilder.from(
            fetcher = Fetcher.of {
// entity from remote source (suspend fun)
                Entity(
                    id = 0,
                    scannedToday = 0,
                    collectedToday = 0,
                    droppedOffToday = 0,
                    beingHandled = 0,
                )
            },
            sourceOfTruth = SourceOfTruth.of(
                reader = appDatabase.dao()::get,
                writer = { _, entity -> appDatabase.dao().insert(entity) },
                delete = appDatabase.dao()::delete,
                deleteAll = appDatabase.dao()::wipe
            )
        ).cachePolicy(
            MemoryPolicy.builder<Any, Any>()
                .setMaxSize(1)
                .setExpireAfterWrite(20.seconds)
                .build()
        )
            .build()
    }

If i run android app all is going well but in IOS as soon as the class that contains the val is initialized i got this error

io.ktor.client.plugins.HttpRequest$1@61240950 thread:  error: Parent job is Cancelling]
kotlin.native.internal.IrLinkageError: Constructor 'CommonWriter.<init>' can not be called: No constructor found for symbol 'co.touchlab.kermit/CommonWriter.<init>|<init>(){}[0]'

also I notices that if I downgrade my dependency to 1.2.2 (the one is used in store5) is solved

kasem-sm commented 1 month ago

Facing the same issue :/