Open julianharty opened 5 years ago
An update: after freeing up over 1GB (plenty for this app's content (roughly 300MB) to fit on the device with space to spare) and restarting the app, it still crashes, this time with the following stack trace:
07-16 18:13:37.134 9695 9695 D ZIMT : Using obbDir [/storage/emulated/0/Android/obb/app.zimternet.traveleurope]
07-16 18:13:37.134 9695 9695 D AndroidRuntime: Shutting down VM
07-16 18:13:37.164 9695 9695 E AndroidRuntime: FATAL EXCEPTION: main
07-16 18:13:37.164 9695 9695 E AndroidRuntime: Process: app.zimternet.traveleurope, PID: 9695
07-16 18:13:37.164 9695 9695 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{app.zimternet.traveleurope/app.zimternet.traveleurope.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.ActivityThread.access$1100(ActivityThread.java:229)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7406)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: Caused by: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at app.zimternet.traveleurope.MainActivity.loadContent(MainActivity.kt:152)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at app.zimternet.traveleurope.MainActivity.onCreate(MainActivity.kt:61)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6904)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
07-16 18:13:37.164 9695 9695 E AndroidRuntime: ... 9 more
07-16 18:13:37.164 701 3991 W ActivityManager: Force finishing activity app.zimternet.traveleurope/.MainActivity
07-16 18:13:37.174 701 3991 D InputDispatcher: Focused application set to: xxxx
Here's a link to the Google Guide for working with expansion files in the app https://developer.android.com/google/play/expansion-files which may provide a useful template for implementing support in the app to download the file(s) when needed.
When testing on a mid-range Android device (a Samsung Galaxy J2 Prime) which had only around 46MB available on internal storage, the app starts and then crashes almost immediately and before any splash screen appears.
It would be great if we can handle the problem in the app rather than leaving Android runtime to cope with the crash.
Note: I installed the app locally using gradle commands, I don't know whether the app store would allow the app to be installed with low free space so this may only be an issue in rare circumstances e.g. if a user deletes an OBB file somehow, then starts our app while there's not enough space for the OBB file to be reinstalled.
From the device's log we can see the following error and crash.