Open madb1lly opened 4 years ago
Did you have any timers set when this crash occurred? This error pretty much means that a scheduled alarm was run for a timer that doesn't exist.
This shouldn't rrrreally be possible - I can certainly add more error handling to prevent this exception from surfacing, but it doesn't seem like a problem with TimerReceiver
. If this occurred shortly after another issue / exception, it could be an after-effect of that.
Hi @fennifith,
No I didn't have any timers set, I wasn't able to set any because of #122.
Cheers š
I got this today. By the way the app is cool. I am an android developer too. I want to do the development and add some extra features i want.
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.get(ArrayList.java:437) at me.jfenn.alarmio.adapters.AlarmsAdapter$AlarmViewHolder$1.afterTextChanged(AlarmsAdapter.kt:450) at android.widget.TextView.sendAfterTextChanged(TextView.java:11664) at android.widget.TextView.setText(TextView.java:6851) at android.widget.TextView.setText(TextView.java:6642) at android.widget.EditText.setText(EditText.java:140) at android.widget.TextView.setText(TextView.java:6594) at me.jfenn.alarmio.adapters.AlarmsAdapter.onBindAlarmViewHolder(AlarmsAdapter.kt:266) at me.jfenn.alarmio.adapters.AlarmsAdapter.onBindViewHolder(AlarmsAdapter.kt:357) at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065) at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107) at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303) at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:561) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665) at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3851) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at androidx.viewpager.widget.ViewPager.onLayout(ViewPager.java:1775) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at androidx.coordinatorlayout.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1213) at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:899) at com.google.android.material.bottomsheet.BottomSheetBehavior.onLayoutChild(BottomSheetBehavior.java:380) at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:918) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at com.android.internal.policy.DecorView.onLayout(DecorView.java:1058) at android.view.View.layout(View.java:23754) at android.view.ViewGroup.layout(ViewGroup.java:7277) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3652) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3112) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2169) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8933) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:996) at android.view.Choreographer.doCallbacks(Choreographer.java:794) at android.view.Choreographer.doFrame(Choreographer.java:729) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:981) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com. android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
I get this consistently when using the snooze feature on alarms.
java.lang.RuntimeException: Unable to start receiver me.jfenn.alarmio.receivers.TimerReceiver: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3426)
at android.app.ActivityThread.access$1200(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1667)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:437)
at me.jfenn.alarmio.receivers.TimerReceiver.onReceive(TimerReceiver.java:18)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3417)
... 8 more
In some ways, this crash is intentional, because it means that Alarmio's database is missing information that it should contain (the information for the current alarm). Evidently, some kind of inconsistency is occurring elsewhere, and - as I haven't yet been able to reproduce this myself - I have no idea where to start with debugging it.
Given that this is occurring somewhat frequently with no obvious reason, the best solution might be to just rebuild Alarmio's storage functionality to be a bit more robust and hopefully do a better job at preventing these problems in future versions. A few of the changes proposed in #128 also coincide with this, and should make the codebase more stable as a whole.
I'm still continuously running into this. The issue occurs every second or third time a particular alarm rings.
Here's my exact scenario:
I am not entirely sure this always happens on the second ring, it might be the third. I have not tried reproducing this without setting a custom alarm ringtone, I'll experiment with this next time.
My system info:
Note this is LineageOS, with microG over Gapps.
@fennifith do you have any hints on how I can help more than just giving a more detailed reproduction scenario? I'd very much like to use this app, but at this point I've overslept a good dozen times because my alarm is an exception shown behind my lockscreen.
I can reliably reproduce this, the steps (presumably with some quirk of my setup) are:
Android Version: 28 Device Manufacturer: samsung Device Model: SM-G950F
Kotlin and this part of Android are foreign to me, but if there's any guidance you can give me to help debug the problem, or details I can provide, please let me know.
I also get these crashes. The following crashes happend after I reseted the storage of the app, created a new alarm and then snoozed the alarm when it rang.
I'm currently running version 1.0.5 from fdroid on Android 10.
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.get(ArrayList.java:437) at me.jfenn.alarmio.adapters.AlarmsAdapter$AlarmViewHolder$1.afterTextChanged(AlarmsAdapter.kt:450) at android.widget.TextView.sendAfterTextChanged(TextView.java:10566) at android.widget.TextView.setText(TextView.java:6283) at android.widget.TextView.setText(TextView.java:6102) at android.widget.EditText.setText(EditText.java:122) at android.widget.TextView.setText(TextView.java:6054) at me.jfenn.alarmio.adapters.AlarmsAdapter.onBindAlarmViewHolder(AlarmsAdapter.kt:266) at me.jfenn.alarmio.adapters.AlarmsAdapter.onBindViewHolder(AlarmsAdapter.kt:357) at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065) at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107) at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303) at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:561) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665) at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3851) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at androidx.viewpager.widget.ViewPager.onLayout(ViewPager.java:1775) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at androidx.coordinatorlayout.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1213) at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:899) at com.google.android.material.bottomsheet.BottomSheetBehavior.onLayoutChild(BottomSheetBehavior.java:380) at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:918) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at com.android.internal.policy.DecorView.onLayout(DecorView.java:779) at android.view.View.layout(View.java:22466) at android.view.ViewGroup.layout(ViewGroup.java:6304) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3157) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2614) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1745) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7768) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967) at android.view.Choreographer.doCallbacks(Choreographer.java:791) at android.view.Choreographer.doFrame(Choreographer.java:726) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952) 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:491) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
java.lang.RuntimeException: Unable to start receiver me.jfenn.alarmio.receivers.TimerReceiver: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at android.app.ActivityThread.handleReceiver(ActivityThread.java:3797) at android.app.ActivityThread.access$1400(ActivityThread.java:219) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870) at android.os.Handler.dispatchMessage(Handler.java:107) 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:491) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940) Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.get(ArrayList.java:437) at me.jfenn.alarmio.receivers.TimerReceiver.onReceive(TimerReceiver.java:18) at android.app.ActivityThread.handleReceiver(ActivityThread.java:3788) ... 8 more
I also encounter these crashes once in a while. In those cases the alarm doesn't go off at all. Today, i woke up about 45 prior to the alarm and took a look at the clock, so the phone maybe wasn't in deepsleep - perhaps that has something to do with it? I can't say for sure if this "waking up shortly before the alarm should go off" was the case for the other crashes, too though.
here's the trace, let me know if i can provide any other useful info :)
java.lang.RuntimeException at TimerReceiver.java:18
java.lang.RuntimeException
java.lang.RuntimeException: Unable to start receiver me.jfenn.alarmio.receivers.TimerReceiver: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3797)
at android.app.ActivityThread.access$1400(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
at android.os.Handler.dispatchMessage(Handler.java:107)
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:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:437)
at me.jfenn.alarmio.receivers.TimerReceiver.onReceive(TimerReceiver.java:18)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3788)
... 8 more
Android Version: 29
Device Manufacturer: Xiaomi
Device Model: Redmi Note 8T
It really seems to have something to do with waking the phone up. Today i woke up about half an hour before the alarm (and of course checked the time, thus waking the phone) and alarm.io crashed again, with a slightly different trace though:
java.lang.RuntimeException at Alarmio.java:118
java.lang.RuntimeException
java.lang.RuntimeException: Unable to create application me.jfenn.alarmio.Alarmio: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=me.jfenn.alarmio/.services.TimerService }: app is in background uid UidRecord{f7d71b3 u0a247 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6465)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
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:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=me.jfenn.alarmio/.services.TimerService }: app is in background uid UidRecord{f7d71b3 u0a247 RCVR idle change:idle|uncached procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1616)
at android.app.ContextImpl.startService(ContextImpl.java:1571)
at android.content.ContextWrapper.startService(ContextWrapper.java:669)
at me.jfenn.alarmio.Alarmio.onCreate(Alarmio.java:118)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
... 8 more
Android Version: 29
Device Manufacturer: Xiaomi
Device Model: Redmi Note 8T
Okay, I get this error as well, this is what I found out: See video for anything described here or further questions.
ā= throws no error ā= throws error
ā fresh install, create timer ā fresh install, snooze timer (continuously) ā fresh install after snoozed timer is cancelled, create new timer ā create alarm, have it inactive, create timer (crashes once timer reached 0) ā create alarm, have it active, create timer (crashes once timer reached 0) ā create alarm (active / inactive), create timer, go back (arrow in top left corner) ā delete all app data, create timer ā delete alarm, create timer
I'm not sure if I did it correctly, I used matlog to try and extract the logcat, one is the entire debug, one is just the errors. The error in question would be at time mark 17:41:48.378 2022-07-31-17-40-59_alarmio-debug.txt 2022-07-31-17-45-06_Alarmio_ErrorsOnly.txt
Redmi 9c MIUI Global 12.0.13 Stable Android 10 (QP1A.190711.020)
Device Info
Steps to Reproduce
This has happened at least twice, once I was in settings after having added time zones and another time the app wasn't even in the foreground, but I had recently copied the stack trace from #122.
EDIT: It happened against whilst viewing the crash notification for the my instance of #113..
Stack trace: