We're building an app which uses HighCharts
Android
wrapper library*. During development, the app is installed on devices/emulators via the Run command, and everything works fine.
But, when making a build view Make Project, Generate Signed APK, or builds produced by CI/DC Pipelines - the app always crashes.
The crash occurs somewhere when Highcharts
calls Gson
(which needs to be externally provided as a dependancy for it in Gradle
build file). Gson
then throws a java.lang.ArrayIndexOutOfBoundsException
exception. (stacktrace below)
what it's not:
- Not related to Android version. tested on API's 29, 25, 23
- Not device related. Happens on Physical devices and emulators running clean android.
- Not
Proguard
related (I think) - happens also ondebug
builds, and also aggressivekeep
statements were added just to be on the safe side. - Same charts work properly on our website and iOS app.
Maybe related:
Highcharts Android
is not yet compatible with Hilt DI
, which is deeply embedded in our code. Apparently, Highcharst
expects the Context
provided to it's View
constructor to be of Activity
type, which is broken with Hilt
since in injects a FragmentContextWrapper
into Fragments
annotated with @AndroidEntryPoint
. description and workaround here
What I'm trying to understand:
What could be the difference in the output .APK
built during Run and Make?
A full description of the crash, with example code, can be found here
* HighCharts
is a JS
charting library. The Android Highcharts
library is a Java
wrapper for JS
that runs on a custom WebView
. The API
is also Java
Objects and functions wrapping JS
code.
Stacktrace:
2020-07-30 09:39:25.679 5627-5627/com.app.android.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.android.debug, PID: 5627
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
at com.google.gson.internal.$Gson$Types.getGenericSupertype($Gson$Types.java:240)
at com.google.gson.internal.$Gson$Types.getSupertype($Gson$Types.java:272)
at com.google.gson.internal.$Gson$Types.getCollectionElementType($Gson$Types.java:290)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:52)
at com.google.gson.Gson.getAdapter(Gson.java:423)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:56)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:97)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:61)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:208)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:208)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:208)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:208)
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.write(MapTypeAdapterFactory.java:145)
at com.google.gson.Gson.toJson(Gson.java:669)
at com.google.gson.Gson.toJson(Gson.java:648)
at com.google.gson.Gson.toJson(Gson.java:603)
at com.google.gson.Gson.toJson(Gson.java:583)
at com.highsoft.highcharts.core.i.a(SourceFile:8)
at com.highsoft.highcharts.core.f.c(SourceFile:2)
at com.highsoft.highcharts.core.HIChartView$q0.update(SourceFile:4)
at java.util.Observable.notifyObservers(Observable.java:163)
at java.util.Observable.notifyObservers(Observable.java:115)
at com.highsoft.highcharts.core.HIFoundation$a.update(SourceFile:4)
at java.util.Observable.notifyObservers(Observable.java:163)
at java.util.Observable.notifyObservers(Observable.java:115)
at com.highsoft.highcharts.common.hichartsclasses.HISeries.setData(SourceFile:3)
at com.app.android.ui.customviews.hicharts.LineGraphChart$applyDataSet$1.run(LineGraphChart.kt:256)
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:7397)
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:935)
from Android app built with "make project" crashes, but not when installed with "Run"
No comments:
Post a Comment