Application crash when enabling cache in SDK

New Member
2 0 0

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?

0 Likes
Shopify Staff
Shopify Staff
240 32 37

Hey @Alex_Crack,

 

Are you able to run the sample app?

0 Likes
Highlighted
New Member
2 0 0

Yes. Sample application works.

I have no ideas...

0 Likes