Application crash when enabling cache in SDK

Highlighted
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
Highlighted
Shopify Staff
Shopify Staff
1041 140 167

Hey @Alex_Crack,

 

Are you able to run the sample app?

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes
New Member
2 0 0

Yes. Sample application works.

I have no ideas...

0 Likes
Highlighted
New Member
1 0 0

how did u fixed it? Please help. I am also getting same problem. Searching for solution from a long time.

0 Likes