AndroidStudio의 App Inspector
> Background Task Inspector
에서 현재 돌아가고있는 Background Task 목록과 상태를 확인할 수 있다. 하지만 사진처럼 Status가 Failed가 떴을때는 정확한 원인을 진단하기가 힘든데, 이때 Worker에 생긴일을 디버깅하는 방법을 소개한다.
adb logcat | grep -e "WM-WorkerWrapper"
터미널에서 위 명령어를 사용하면 WorkerManager 관련 로그들이 필터링된다. adb
가 낯설다면 이 포스트(adb 개념과 사용방법)를 참조하면된다. 아니면 AndroidStudio내 logcat에서 로그 수준을 Info로 낮추고 찾아도된다!
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: Work [ id=2ea2afd5-dfdd-4835-8d11-6023e218d184, tags={ com.samsung.android.scs.ai.search.scheduling.workers.AppsDataWorker, CMD_UPDATE_LIST } ] was cancelled
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: java.util.concurrent.CancellationException: Task was cancelled.
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at androidx.work.impl.utils.futures.AbstractFuture.cancellationExceptionWithCause(AbstractFuture.java:1184)
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:514)
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475)
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:300)
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
09-13 16:54:01.737 14800 14838 I WM-WorkerWrapper: at java.lang.Thread.run(Thread.java:920)
09-13 16:54:04.823 14800 14838 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=61649b43-a21c-496e-aeff-36189cfb63e0, tags={ com.samsung.android.scs.ai.search.scheduling.workers.AppsDataWorker, CMD_UPDATE_LIST } ]
09-13 16:55:06.404 24604 24696 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=fb54d836-283d-4141-81c4-c8d4d4f08d3f, tags={ com.onestore.android.shopclient.worker.NotifyUpdateInfoWorker } ]
09-13 17:01:50.007 24604 24696 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=30698cc2-7aa7-478c-8e0c-7ff73620e72c, tags={ com.onestore.android.shopclient.worker.ReschedulePersistedJobsWorker } ]
09-13 17:02:29.245 27289 27325 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=22e9c864-7164-4ba5-a913-00173874be80, tags={ com.samsung.android.app.shealth.social.together.service.SocialSyncLoopMonitorWorker } ]
09-13 17:03:04.891 27525 27581 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=d378af75-8da4-40ae-ae6e-e538184a38a1, tags={ com.samsung.android.scs.ai.search.scheduling.workers.InitialIndexingWorker, InitialIndexingWorker } ]
09-13 17:03:05.002 27525 27581 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=8cc986a4-0b21-452b-844b-536166690d5e, tags={ com.samsung.android.scs.documents, com.samsung.android.scs.ai.search.data.collector.ObserverWorker } ]
09-13 17:03:05.211 27525 27580 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=9572ab9c-f4e9-4d39-b6df-87e6a4ed0877, tags={ com.samsung.android.scs.ai.search.scheduling.workers.AppsDataWorker, CMD_SCAN } ]
09-13 17:03:09.216 27525 27582 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=76c80b72-cf21-4ad8-aedc-dd1a750a516d, tags={ logs.call, com.samsung.android.scs.ai.search.data.collector.ObserverWorker } ]
09-13 17:07:24.458 25369 25476 E WM-WorkerWrapper: Could not create Worker com.xxx.xxx.service.FCMWorker
09-13 17:07:24.796 25369 25473 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=efd84f10-0529-4f94-ad0a-f0c52716a40b, tags={ com.gna.playio.service.HealthCheckWorker } ]
09-13 17:07:25.277 17811 17871 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=22d72f6b-e88b-4784-9f49-b524b6966935, tags={ com.twitter.client.sync.DeviceSyncWorker } ]
09-13 17:11:16.462 17811 17871 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=0bf05d58-8fc3-431c-a315-878ccbf19e34, tags={ com.twitter.analytics.service.core.workmanager.AnalyticsFlushWorker } ]
09-13 17:12:09.361 28695 28718 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=fb3dbfcf-f397-4bc3-8f9c-961076c02e5d, tags={ com.sec.unifiedwfc.ux.workers.EpdgEventWorker } ]
09-13 17:12:11.384 27525 27580 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=d1b1be7e-2eef-4945-ab4f-f25d2ef10176, tags={ com.samsung.android.scs.ai.search.scheduling.workers.AppsDataWorker, CMD_UPDATE_LIST } ]
09-13 17:15:31.132 25369 25476 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=2d7a839c-3be5-427a-963e-e69a939d8002, tags={ androidx.work.impl.workers.DiagnosticsWorker } ]
09-13 17:15:47.209 13631 13663 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=b5af74d2-975c-4ae9-a110-0e1436aebf26, tags={ com.google.apps.tiktok.contrib.work.TikTokListenableWorker, TikTokWorker#com.google.apps.tiktok.sync.impl.workmanager.SyncWorker } ]
09-13 17:16:50.390 29069 29129 E WM-WorkerWrapper: Could not create Worker com.onestore.android.shopclient.worker.ReschedulePersistedJobsWorker
09-13 17:16:50.606 17811 17878 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=8b175656-fba6-46b5-b6b2-2dc7eab798f4, tags={ com.twitter.repository.hashflags.HashflagRefreshWorker } ]
실제 로그의 모습인데, FCMWorker
에 문제가 있었는데 로그을 보면 "Could not create Worker"라고 워커를 생성할 수 없어서 실패했음을 알 수 있다.
'프로그래밍 > Android' 카테고리의 다른 글
[안드로이드] 예제로 보는 NavigationComponent (2) | 2022.09.18 |
---|---|
[안드로이드] HiltWorker 오류 Could not create Worker 해결방법 (0) | 2022.09.13 |
[안드로이드] View를 터치 입력에 따라 회전하기 (핸들 구현) (0) | 2022.08.24 |
[안드로이드] 실시간 네크워크 상태 callbackFlow를 이용해 만들어보자! (Youtube 인터넷 연결처럼 구현) (0) | 2022.08.13 |
[Android] 멋진 오픈소스 프로젝트 모음 - Awesome Android Kotlin Apps (0) | 2022.08.11 |