Shopify / mobile-buy-sdk-android

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using their credit card.
MIT License
214 stars 137 forks source link

Enabling cache crashes application with okhttp3 v4 #623

Open alexcrack opened 4 years ago

alexcrack commented 4 years ago

I create GraphClient with custom http client in this way

    private fun initGraphClient() {

        val okHttpClient = OkHttpClient.Builder()
            .addNetworkInterceptor(HttpLoggingInterceptor())
            .build()

        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)
            }
        }
    }

Then application crashes at starting with error

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: [processname], PID: 5205
    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/EZ6-aUqggoy3GHIzWD3NeA==/base.apk)
        at com.shopify.buy3.internal.cache.DiskLruCacheStore.<init>(DiskLruCacheStore.kt:43)

SDK version: 3.6.0 okhttp3 client version: 4.2.1

Method 'create' was removed in okhttp3 v4.x.x branch

TaraAndroid commented 2 years ago

any solutions?

GaneshShetty951 commented 2 years ago

@alexcrack Have you found any solution for this?

alexcrack commented 2 years ago

No. Startup was failed and application was abandoned. I didn't try with any new versions.