android – Shopify's mobile buy SDK enabling caching crashes application-ThrowExceptions

Exception or error:

I’m creating application for Android with Kotlin.

I use Mobile buy SDK version 3.6.0

implementation 'com.shopify.mobilebuysdk:buy3:3.6.0'

I build Graph client with this code:

        graphClient = GraphClient.build(this,
            BuildConfig.SHOP_DOMAIN,
            BuildConfig.API_KEY
        ) {
            httpClient = okHttpClient

            httpCache(cacheDir) {
                cacheMaxSizeBytes = 10 * 1024 * 1024
                defaultCachePolicy = HttpCachePolicy.Default.CACHE_FIRST.expireAfter(5, TimeUnit.MINUTES)
            }
        }

And application crashes on start with error

java.lang.NoSuchMethodError: No static method create(Lokhttp3/internal/io/FileSystem;Ljava/io/File;IIJ)Lokhttp3/internal/cache/DiskLruCache; in class Lokhttp3/internal/cache/DiskLruCache; or its super classes (declaration of 'okhttp3.internal.cache.DiskLruCache' appears in /data/app/com.example.app/base.apk)
        at com.shopify.buy3.internal.cache.DiskLruCacheStore.<init>(DiskLruCacheStore.kt:43)
        at com.shopify.buy3.GraphClient$Config.build(GraphClient.kt:189)
        at com.shopify.buy3.GraphClient$Companion.build(GraphClient.kt:131)

How can I fix this problem?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *