Closed ponthamaya closed 3 years ago
Could I ask how you managed to make this happen, if you still remember? Sorry this is late lol.
A possible fix for this would be to convert intent
variable from lateinit to a getter:
val Context.intent: Intent
get() = Intent(this, CrashDetectorService::class.java)
or to a regular function:
private fun getIntent(context: Context) = Intent(this, CrashDetectorService::class.java)
This would fix lateinit var not getting initialized but I'm not sure if there's a performance impact on spawning Intent
objects, although a slight impact would not matter if it fixes the crash.
@X1nto Yeah, I was thinking that as well. Not gotten around to fixing it yet as there's a bunch of life stuff that's been happening for like the past month. Thanks for the reminder about this issue, I'll get to it when I can :)
@X1nto Made a quick thing here, would this also work? https://github.com/TacoTheDank/Scoop/commit/4cdd2acc78cf5702e9c1d5293fda6f6a60d7d1a8
@X1nto Made a quick thing here, would this also work? https://github.com/TacoTheDank/Scoop/commit/4cdd2acc78cf5702e9c1d5293fda6f6a60d7d1a8
Quite possibly, it might fix the crash. Can't say anything until the issue author tests it :)
FATAL EXCEPTION: main Process: taco.scoop, PID: 27184 java.lang.RuntimeException: Unable to start receiver taco.scoop.core.receiver.StopReceiver: kotlin.UninitializedPropertyAccessException: lateinit property intent has not been initialized at android.app.ActivityThread.handleReceiver(ActivityThread.java:3798) at android.app.ActivityThread.access$1400(ActivityThread.java:220) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1871) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7403) 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) Caused by: kotlin.UninitializedPropertyAccessException: lateinit property intent has not been initialized at taco.scoop.util.ServiceUtilsKt.getIntent(ServiceUtils.kt:10) at taco.scoop.util.ServiceUtilsKt.stopScoopService(ServiceUtils.kt:35) at taco.scoop.core.receiver.StopReceiver.onReceive(StopReceiver.kt:11) at android.app.ActivityThread.handleReceiver(ActivityThread.java:3789) ... 8 more