-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to instantiate the client #4597
Comments
Per the release notes, OkHttp requires that you enable Java 8 in your builds to function as of 3.13 and newer. You can learn more about how to enable this at https://developer.android.com/studio/write/java8-support. You need to add something like android {
compileOptions {
targetCompatibility = "8"
sourceCompatibility = "8"
}
} to your application |
hello, i enabled JAVA 8 but it still did not work
|
@CHENGCHANGHU make sure to do a Clean Project ( |
After adding compileOption... cleaning and Building the project solved my problem thanks guys |
I have the same problem. Thank you for sharing. |
Summary: Requires some compile options as it uses newer Java features. Post here: square/okhttp#4597 (comment) Reviewed By: jknoxville Differential Revision: D14933502 fbshipit-source-id: 265c43f2d9ae61fa9f6f42516fc6eb899af7f072
thanks you |
Just a hint for somebody wanting to add the compile options into compileOptions {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
} |
- Replaced kotlinx serializer by gson serializer due to open issue in github Kotlin/kotlinx.serialization#576 - Replaced okhttp android client by ktor android client due to issues related to kotlin. It seems that it is related to latest version of okjhttp but even compiling with jvm target 1.8 is still failing: square/okhttp#4597
While trying to instantiate OkHttpClient as follows inside the MainActivity of android:
OkHttpClient client = new OkHttpClient();
Stacktrace :
Happens only on 3.13.1. Works well on 3.12.1.
Any insights?
The text was updated successfully, but these errors were encountered: