Bug Report: Incompatibility with OkHttp 5.x – NoClassDefFoundError: okhttp3.internal.Util
👟 Reproduction steps
- Add
implementation("com.squareup.okhttp3:okhttp:5.1.0")to dependencies - Use Appwrite SDK in your Android app
- Run a request that uses cookies
- Crash occurs at
ListenableCookieJar
👍 Expected behavior
- The Appwrite SDK should not rely on internal or private OkHttp classes.
ListenableCookieJarshould use only public APIs (e.g.java.net.HttpCookie.parse(...)) to handle cookies.- App should work normally without crashing when using OkHttp 5.x.
👎 Actual Behavior
- App crashes at runtime with the following error:
- Caused by internal API usage that was removed in OkHttp 5.1.0.
- Makes it impossible to use Appwrite SDK with the latest OkHttp versions.
🎲 Appwrite version
Appwrite Cloud
💻 Operating system
Something else
🧱 Your Environment
- Appwrite SDK version: 8.1.0
- OkHttp version: 5.1.0
- Android version: Any
- Crash location:
ListenableCookieJar.kt
👀 Have you spent some time to check if this issue has been raised before?
- [x] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [x] I have read the Code of Conduct
@midou221 hi there, thanks for raising this issue. can you please share the full stack trace of the error so we can pinpoint which internally removed API is being used by the appwrite sdk?
i am not able to find anything particular in the changelog
https://square.github.io/okhttp/changelogs/changelog/
@midou221 hi there, thanks for raising this issue. can you please share the full stack trace of the error so we can pinpoint which internally removed API is being used by the appwrite sdk?
Here’s the full stack trace
Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Util" on path: DexPathList[[zip file "/data/app/org.example-Ro1f0UMkG_IWRQNxsaF_cA==/base.apk"],nativeLibraryDirectories=[/data/app/org.example-Ro1f0UMkG_IWRQNxsaF_cA==/lib/arm64, /data/app/org.example-Ro1f0UMkG_IWRQNxsaF_cA==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /product/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at io.appwrite.cookies.ListenableCookieJar.decodeHeaderAsJavaNetCookies(ListenableCookieJar.kt:88) at io.appwrite.cookies.ListenableCookieJar.loadForRequest(ListenableCookieJar.kt:66) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:75) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:74) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:208) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:530) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:784)
The crash is triggered because the Appwrite SDK still references okhttp3.internal.Util, which was removed in OkHttp 5.x.