Task Manager Location Update Crash Looper

Please provide the following:

  1. SDK Version: 38
  2. Android

I try to implement geofencing with Task manager of Expo and startLocationUpdate. App crashes when app is killed!! Android 10 not show any notification of background task!!!

java.lang.NullPointerException: Attempt to invoke interface method ‘void l.d.a.c.a(android.content.Context, l.d.a.c$b, java.lang.Runnable, l.d.b.l.e)’ on a null object reference
at android.app.job.JobService$JobHandler.handleMessage(JobService.java:147)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6816)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method ‘void l.d.a.c.a(android.content.Context, l.d.a.c$b, java.lang.Runnable, l.d.b.l.e)’ on a null object reference
at expo.modules.taskManager.TaskService.executeTask(TaskService.java:17)
at expo.modules.taskManager.Task.execute(Task.java:2)
at expo.modules.location.taskConsumers.LocationTaskConsumer.executeTaskWithLocationBundles(LocationTaskConsumer.java:4)

With Android debug is see that background works until app closed but debug show every time this error:
Didn’t find class "host.exp.exponent.taskManager.ExpoHeadlessAppLoader

but he continue to run without fail… When i close App it starts to crash

java.lang.ClassNotFoundException: host.exp.exponent.taskManager.ExpoHeadlessAppLoader

Having the exact same problem!! Expo and built APK crash when killing app with a running Task. Has any one found any workaround?

Same Issue over here. Any workaround?

08-06 19:13:17.616: E/libc(640): Access denied finding property "vendor.debug.egl.swapinterval"
08-06 19:13:17.620: D/LifecycleMonitor(19350): Lifecycle status change: host.exp.exponent.MainActivity@9ceec4d in: RESTARTED
08-06 19:13:17.621: D/LifecycleMonitor(19350): Lifecycle status change: host.exp.exponent.MainActivity@9ceec4d in: STARTED
08-06 19:13:17.623: E/Expo(19350): Cannot initialize app loader. host.exp.exponent.taskManager.ExpoHeadlessAppLoader
08-06 19:13:17.623: W/System.err(19350): java.lang.ClassNotFoundException: host.exp.exponent.taskManager.ExpoHeadlessAppLoader
08-06 19:13:17.623: W/System.err(19350): 	at java.lang.Class.classForName(Native Method)
08-06 19:13:17.623: W/System.err(19350): 	at java.lang.Class.forName(Class.java:453)
08-06 19:13:17.623: W/System.err(19350): 	at java.lang.Class.forName(Class.java:378)
08-06 19:13:17.623: W/System.err(19350): 	at l.d.a.b.a(AppLoaderProvider.java:2)
08-06 19:13:17.623: W/System.err(19350): 	at l.d.a.b.b(AppLoaderProvider.java:2)
08-06 19:13:17.623: W/System.err(19350): 	at expo.modules.taskManager.TaskService.getAppLoader(TaskService.java:2)
08-06 19:13:17.623: W/System.err(19350): 	at expo.modules.taskManager.TaskService.isStartedByHeadlessLoader(TaskService.java:1)
08-06 19:13:17.623: W/System.err(19350): 	at expo.modules.taskManager.TaskManagerInternalModule.isRunningInHeadlessMode(TaskManagerInternalModule.java:1)
08-06 19:13:17.623: W/System.err(19350): 	at expo.modules.taskManager.TaskManagerInternalModule.onHostResume(TaskManagerInternalModule.java:1)
08-06 19:13:17.623: W/System.err(19350): 	at org.unimodules.adapters.react.services.d$c.onHostResume(UIManagerModuleWrapper.java:2)
08-06 19:13:17.623: W/System.err(19350): 	at com.facebook.react.bridge.ReactContext.onHostResume(ReactContext.java:5)
08-06 19:13:17.623: W/System.err(19350): 	at com.facebook.react.ReactInstanceManager.moveToResumedLifecycleState(ReactInstanceManager.java:3)
08-06 19:13:17.623: W/System.err(19350): 	at com.facebook.react.ReactInstanceManager.onHostResume(ReactInstanceManager.java:11)
08-06 19:13:17.623: W/System.err(19350): 	at com.facebook.react.ReactInstanceManager.onHostResume(ReactInstanceManager.java:3)
08-06 19:13:17.623: W/System.err(19350): 	at java.lang.reflect.Method.invoke(Native Method)
08-06 19:13:17.623: W/System.err(19350): 	at host.exp.exponent.k.a(RNObject.java:17)
08-06 19:13:17.623: W/System.err(19350): 	at host.exp.exponent.k.a(RNObject.java:12)
08-06 19:13:17.623: W/System.err(19350): 	at host.exp.exponent.k.a(RNObject.java:58)
08-06 19:13:17.623: W/System.err(19350): 	at host.exp.exponent.experience.k.onResume(ReactNativeActivity.java:3)
08-06 19:13:17.623: W/System.err(19350): 	at host.exp.exponent.experience.f.onResume(BaseExperienceActivity.java:1)
08-06 19:13:17.623: W/System.err(19350): 	at host.exp.exponent.experience.ExperienceActivity.onResume(ExperienceActivity.java:1)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1412)
08-06 19:13:17.623: W/System.err(19350): 	at androidx.test.runner.MonitoringInstrumentation.callActivityOnResume(MonitoringInstrumentation.java:21)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.Activity.performResume(Activity.java:7300)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3814)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3854)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
08-06 19:13:17.623: W/System.err(19350): 	at android.os.Handler.dispatchMessage(Handler.java:106)
08-06 19:13:17.623: W/System.err(19350): 	at android.os.Looper.loop(Looper.java:193)
08-06 19:13:17.623: W/System.err(19350): 	at android.app.ActivityThread.main(ActivityThread.java:6718)
08-06 19:13:17.623: W/System.err(19350): 	at java.lang.reflect.Method.invoke(Native Method)
08-06 19:13:17.623: W/System.err(19350): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-06 19:13:17.623: W/System.err(19350): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
08-06 19:13:17.623: W/System.err(19350): Caused by: java.lang.ClassNotFoundException: Didn't find class "host.exp.exponent.taskManager.ExpoHeadlessAppLoader" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/androidx.test.tools.crawler-V7YOToxANzJO97jszGhvcw==/base.apk", zip file "/data/app/com.xyz.xyz_android-NillPNLUDYonLAXgOycLDg==/base.apk", zip file "/data/app/com.xyz.xyz_android-NillPNLUDYonLAXgOycLDg==/split_config.arm64_v8a.apk", zip file "/data/app/com.xyz.xyz_android-NillPNLUDYonLAXgOycLDg==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/androidx.test.tools.crawler-V7YOToxANzJO97jszGhvcw==/lib/arm64, /data/app/com.xyz.xyz_android-NillPNLUDYonLAXgOycLDg==/lib/arm64, /data/app/androidx.test.tools.crawler-V7YOToxANzJO97jszGhvcw==/base.apk!/lib/arm64-v8a, /data/app/com.xyz.xyz_android-NillPNLUDYonLAXgOycLDg==/base.apk!/lib/arm64-v8a, /data/app/com.xyz.xyz_android-NillPNLUDYonLAXgOycLDg==/split_config.arm64_v8a.apk!/lib/arm64-v8a, /data/app/com.xyz.xyz_android-NillPNLUDYonLAXgOycLDg==/split_config.xxhdpi.apk!/lib/arm64-v8a, /system/lib64]]
08-06 19:13:17.623: W/System.err(19350): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
08-06 19:13:17.623: W/System.err(19350): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
08-06 19:13:17.623: W/System.err(19350): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)



sdk: 38

Looks like this issue: https://github.com/expo/expo/issues/9570. Anyone can confirm?

@kleinhenz Yes it is the same issue. I solved it by ejecting from expo and upgrading the expo-task-manger to 8.4.0. Was a pain to set up since I am a newb with Android Studio, but it got the job done. No crashes so far. I hear the SDK 39 will include this fix so there won’t be a need to eject anymore.

I made this thread to tie together everything I’ve seen on this topic…maybe someone from Expo will respond there.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.