question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ArrayIndexOutOfBoundsException crash from SDK when DP3T.sendIAmInfected() is called

See original GitHub issue

ArrayIndexOutOfBoundsException crash from SDK when DP3T.sendIAmInfected() is called. SDK: DP-3T SDK 1.0.0 GAEN: v1.3.1

I have an Android DP-3T related crash I am getting intermittently.

I do a clean install of our app. It uses the 1.0.0 DP-3T SDK and play-services-nearby-18.0.2-eap-v1.3.1.aar I give all the permissions and GAEN works on this device. After our onboarding flow GAEN activates (Settings -> Google -> COVID-19 submenu also confirms this)

Immediately after install, I start our infection confirmation flow. In the flow as a user, I enter the onsetDate as today’s date. After our app has confirmed with our backend that I am allowed to confirm my infection then our app calls the DP-3T SDK:

DP3T.sendIAmInfected(activity, onsetDate, ...

DP-3T SDK crashes with

java.lang.ArrayIndexOutOfBoundsException: length=0; index=0 at com.google.gson.internal.$Gson$Types.getGenericSupertype($Gson$Types.java:248) at com.google.gson.internal.$Gson$Types.getSupertype($Gson$Types.java:284) at com.google.gson.internal.$Gson$Types.getCollectionElementType($Gson$Types.java:302) at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:52) at com.google.gson.Gson.getAdapter(Gson.java:458) at com.google.gson.Gson.fromJson(Gson.java:926) at com.google.gson.Gson.fromJson(Gson.java:892) at com.google.gson.Gson.fromJson(Gson.java:841) at com.google.gson.Gson.fromJson(Gson.java:813) at org.dpppt.android.sdk.internal.util.Json.fromJson(Json.java:34) at org.dpppt.android.sdk.internal.PendingKeyUploadStorage.getPendingKeys(PendingKeyUploadStorage.java:53) at org.dpppt.android.sdk.internal.PendingKeyUploadStorage.addPendingKey(PendingKeyUploadStorage.java:85) at org.dpppt.android.sdk.DP3T$1.onSuccess(DP3T.java:277) at org.dpppt.android.sdk.DP3T$1.onSuccess(DP3T.java:269) at org.dpppt.android.sdk.internal.backend.BackendReportRepository$1.onResponse(BackendReportRepository.java:54) at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.lambda$onResponse$0$DefaultCallAdapterFactory$ExecutorCallbackCall$1(DefaultCallAdapterFactory.java:89) at retrofit2.-$$Lambda$DefaultCallAdapterFactory$ExecutorCallbackCall$1$3wC8FyV4pyjrzrYL5U0mlYiviZw.run(Unknown Source:6) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7356) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

from the line PendingKeyUploadStorage.getInstance(activity).addPendingKey(delayedKey); inside the public void onSuccess(String authToken) callback. As nobody will catch the Exception then our whole app also crashes.

So IMHO two issues here:

  1. The crash itself
  2. That the code running in the callback should also handle unexpected errors better and not crash the app, but just give a failure callback to the app.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fbzlicommented, Jul 9, 2020

Any chance you have Proguard enabled? I can only reproduce this with obfuscation enabled specifically.

The PendingKey model appears to be in the wrong package/class, thus is not protected by the proguard exemption rules. We’re going to fix that.

0reactions
fbzlicommented, Jul 10, 2020

I pushed a fix. That should work with any Proguard configuration and/or core library desugaring enabled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found