retrofit2

Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;

自古美人都是妖i 提交于 2021-02-06 15:26:13
问题 I'm using RxJava with Retrofit on the newest preview of AndroidStudio. My project has java 1.8 suport enabled like this: compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } But when the code is compiled and run I'm getting this error, as soon as the request is made, even if I have the onError handler: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension; at io.reactivex.plugins.RxJavaPlugins.onError

Right way of using RxJava + Retrofit 2

核能气质少年 提交于 2021-02-06 13:52:08
问题 I have such JSON: { "success":true, "data":[ { "id":"29", "name":"\u0420\u0435\u0441\u0442\u043e\u0440\u0430\u0446\u0456\u044f \u0411\u0430\u0447\u0435\u0432\u0441\u044c\u043a\u0438\u0445 \/ Baczewski Restaurant", "street":"\u0432\u0443\u043b. \u0428\u0435\u0432\u0441\u044c\u043a\u0430, 8", "latitude":"49.842292845502", "longitude":"24.029848249565", "image":"https:\/\/i.onthe.io\/j9aocq72r2lfsmoh9.r500x500.01ff9fff.jpg" }, ... ] } According to it have to Classes (pojo) created with schema to

Right way of using RxJava + Retrofit 2

≡放荡痞女 提交于 2021-02-06 13:48:59
问题 I have such JSON: { "success":true, "data":[ { "id":"29", "name":"\u0420\u0435\u0441\u0442\u043e\u0440\u0430\u0446\u0456\u044f \u0411\u0430\u0447\u0435\u0432\u0441\u044c\u043a\u0438\u0445 \/ Baczewski Restaurant", "street":"\u0432\u0443\u043b. \u0428\u0435\u0432\u0441\u044c\u043a\u0430, 8", "latitude":"49.842292845502", "longitude":"24.029848249565", "image":"https:\/\/i.onthe.io\/j9aocq72r2lfsmoh9.r500x500.01ff9fff.jpg" }, ... ] } According to it have to Classes (pojo) created with schema to

Right way of using RxJava + Retrofit 2

非 Y 不嫁゛ 提交于 2021-02-06 13:47:29
问题 I have such JSON: { "success":true, "data":[ { "id":"29", "name":"\u0420\u0435\u0441\u0442\u043e\u0440\u0430\u0446\u0456\u044f \u0411\u0430\u0447\u0435\u0432\u0441\u044c\u043a\u0438\u0445 \/ Baczewski Restaurant", "street":"\u0432\u0443\u043b. \u0428\u0435\u0432\u0441\u044c\u043a\u0430, 8", "latitude":"49.842292845502", "longitude":"24.029848249565", "image":"https:\/\/i.onthe.io\/j9aocq72r2lfsmoh9.r500x500.01ff9fff.jpg" }, ... ] } According to it have to Classes (pojo) created with schema to

How to have Retrofit to unescape HTML escaped symbols?

假如想象 提交于 2021-02-05 11:46:38
问题 I use Retrofit2 and GSON to deserialize incoming JSON. Here is my code in Android app: public class RestClientFactory { private static GsonBuilder gsonBuilder = GsonUtil.gsonbuilder; private static Gson gson; private static OkHttpClient.Builder httpClient; private static HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor() .setLevel(HttpLoggingInterceptor.Level.BASIC); static { gsonBuilder.setDateFormat(DateUtil.DATETIME_FORMAT); httpClient = new OkHttpClient.Builder()

Unable connect to a HTTP URL in Android 10

谁说胖子不能爱 提交于 2021-02-05 06:57:05
问题 I am using a http://something API for the login process. But could't get a hit on API in Android 10. For rest of the version, the API is working fine. First of all, I was getting SocketTimeoutException . Then I tried following solutions. 1) Added below attribute to <application> in Manifest. android:usesCleartextTraffic="true" Result: Still getting SocketTimeoutException . 2) Then I added networkSecurityConfig : <network-security-config> <domain-config cleartextTrafficPermitted="true">

lateinit property data has not been initialized

老子叫甜甜 提交于 2021-02-05 05:57:26
问题 Gson Convertable data is not set in Recyclerview using Retrofit2 and rxjava2 then subscribe throughble its Give Error: UninitializedPropertyAccessException: lateinit property data has not been initialized JSON data parsing by retrofit2 and rxjava2. when parsing GSON Data Converting GSon, rxjava2 Subscribe the data then give lateinit property error and its not set in recyclerview. MainActivity.kt class Company : AppCompatActivity() { internal lateinit var api : APIInterface var

retrofit retry with the new token request?

雨燕双飞 提交于 2021-01-29 10:53:24
问题 I get new token when any request return TOKEN_IS_NOT_ACTIVE then I get a new token In interceptor override fun intercept(chain: Interceptor.Chain): Response { val request = chain.request() var response = chain.proceed(request) val bodyString = response.peekBody(AppConstants.BUFFER_SIZE_2MB)?.string() val json = JSONObject(bodyString) //after get new token retry with the failedRequest if(json.has("token"){ failedRequest=failedRequest.newBuilder().removeHeader("Authorization").removeHeader("")

list is not getting in recyclerview using retrofit

Deadly 提交于 2021-01-29 10:48:33
问题 basically im trying display list in recyclerview using retrofit and viewmodel........ on debugging the onresponse im getting 200 response but why is it not displaying list in recyclerview i dont know where im going wrong i will post up more codes if needed following is the code:--- class Tables : BaseClassActivity() { lateinit var recyclerView: RecyclerView lateinit var recyclerAdapter: TableAdapter var Tablelist : MutableList<Tabledata> = mutableListOf() override fun onCreate

How can I retrieve the errorBody sent from server on retrofit error handler?

99封情书 提交于 2021-01-29 08:31:13
问题 When everything goes well, I can retrieve the body from response.body() with no problem. Althought, when a validation error occurs on server (in my case, duplicated email) it sends the error to frontend and when I try to access the error body response.errorBody() the following info is retrieved: "E/API Activity: onResponse: PostSalao okhttp3.ResponseBody$1@84d856e" I expected to get something like "error: email already used" . As you may see on this video on (10:08), he does the same thing I