I
I
Ilya2018-06-01 14:50:00
Android
Ilya, 2018-06-01 14:50:00

Crashes on api request. Only signed application. Unsigned apk works. How to win?

Good afternoon.
Updated gradle on the app. Released with 50% coverage. Some users (rather small and on version 5.1) cursed at the error.
when the application starts, a request is made to the server to receive regions. On most devices everything is fine. But on some Chinese (maybe not only, but reproduced only in Chinese), we get such an error on the request

java.lang.reflect.UndeclaredThrowableException
        at $Proxy2.getRegions(Unknown Source)
        at com.test.apk.c.e$1.a(TaskManagerRegion.java:40)
        at com..test.apk.c.e$1.call(TaskManagerRegion.java:37)
        at bolts.f$6.run(Task.java:249)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:818)
        at com.test.apk.util.h$1.run(PriorityThreadFactory.java:43)
     Caused by: java.lang.Exception: retrofit.RetrofitError: length=2048; index=317205120
        at com.test.apk.server.a.handleError(CustomErrorHandler.java:22)
        at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:242)
        at java.lang.reflect.Proxy.invoke(Proxy.java:397)
        at $Proxy2.getRegions(Unknown Source) 
        at com.test.apk.c.e$1.a(TaskManagerRegion.java:40) 
        at com.test.apk.c.e$1.call(TaskManagerRegion.java:37) 
        at bolts.f$6.run(Task.java:249) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at java.lang.Thread.run(Thread.java:818) 
        at com.test.apk.util.h$1.run(PriorityThreadFactory.java:43) 
     Caused by: retrofit.RetrofitError: length=2048; index=317205120
        at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:400)
        at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
        at java.lang.reflect.Proxy.invoke(Proxy.java:397) 
        at $Proxy2.getRegions(Unknown Source) 
        at com.test.apk.c.e$1.a(TaskManagerRegion.java:40) 
        at com.test.apk.c.e$1.call(TaskManagerRegion.java:37) 
        at bolts.f$6.run(Task.java:249) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at java.lang.Thread.run(Thread.java:818) 
        at com.test.apk.util.h$1.run(PriorityThreadFactory.java:43) 
     Caused by: java.lang.ArrayIndexOutOfBoundsException: length=2048; index=317205120
        at b.b.a(Base64.java:137)
        at b.b.a(Base64.java:125)
        at b.f.b(ByteString.java:104)
        at com.squareup.okhttp.Cache$Entry.writeCertList(Cache.java:644)
        at com.squareup.okhttp.Cache$Entry.writeTo(Cache.java:608)
        at com.squareup.okhttp.Cache.put(Cache.java:239)
        at com.squareup.okhttp.Cache.access$000(Cache.java:131)
        at com.squareup.okhttp.Cache$1.put(Cache.java:142)
        at com.squareup.okhttp.internal.http.HttpEngine.maybeCache(HttpEngine.java:404)
        at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:647)
        at com.squareup.okhttp.Call.getResponse(Call.java:287)
        at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
        at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
        at com.squareup.okhttp.Call.execute(Call.java:80)
        at retrofit.client.OkClient.execute(OkClient.java:53)
        at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
        at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240) 
        at java.lang.reflect.Proxy.invoke(Proxy.java:397) 
        at $Proxy2.getRegions(Unknown Source) 
        at com.test.apk.c.e$1.a(TaskManagerRegion.java:40) 
        at com.test.apk.c.e$1.call(TaskManagerRegion.java:37) 
        at bolts.f$6.run(Task.java:249) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
        at java.lang.Thread.run(Thread.java:818) 
        at com.test.apk.util.h$1.run(PriorityThreadFactory.java:43

Tried to revert the changes by gradle - the error still repeats.
We tried to run it in Chinese in debugging - the error does not repeat. Installing an unsigned version via adb - the error does not repeat. We sign apk, install - the error appears immediately ..
Thank you

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2018-06-04
@postnik

Decision.
https://issuetracker.google.com/issues/69364976

buildscript {
  repositories {
    google()
    ...
  }
  dependencies {
    ...
    // D8/R8 must appear before gradle.
    classpath "com.android.tools:r8:1.0.23"
    classpath 'com.android.tools.build:gradle:3.1.0'
    ...
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question