android-lifecycle-debugger

Diagnose Android lifecycle bugs involving Activity, Fragment, ViewModel, and process death.

1|Updated Jun 27, 2026
One-click install
npx skills add https://github.com/TE-QuanBZhang/skills-pool --skill android-lifecycle-debugger-te-quanbzhang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-lifecycle-debugger
Source: https://github.com/TE-QuanBZhang/skills-pool/tree/main/ai-coding/skills/android-lifecycle-debugger
Command: npx skills add https://github.com/TE-QuanBZhang/skills-pool --skill android-lifecycle-debugger-te-quanbzhang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Android bugs caused by lifecycle mismatches—such as crashes after rotation, blank screens after back navigation, duplicate requests after recreation, or callbacks updating destroyed views—are hard to trace. This Skill provides a structured workflow to map bugs to lifecycle transitions and identify state ownership mistakes. ## Core Features & Use Cases - Lifecycle Scenario Mapping: Classifies bugs by trigger, including configuration changes, process death, fragment replacement, and navigation back stack restore. - State Ownership Analysis: Determines whether state lives in the right place (ViewModel, SavedStateHandle, Fragment field, or repository) and flags incorrect ownership. - Async Work Inspection: Finds coroutines, Flow collectors, LiveData observers, and callbacks that outlive their lifecycle owner, with optional CodeGraph integration for tracing call sites. - Use Case: A user reports a blank screen after rotating the device during checkout. Use this Skill to trace the state owner, find a collector bound to the wrong scope, and get a fix recommendation plus regression test plan. ## Quick Start Debug why my Fragment shows a blank screen and duplicate network requests after rotating the device.

Frequently Asked Questions about android-lifecycle-debugger

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug Android lifecycle bugs after screen rotation?

Map the bug to the configuration change scenario, then check where state is stored. State held in Fragment or Activity fields is lost on recreation; move durable state to a ViewModel or SavedStateHandle and collect Flows with repeatOnLifecycle.

How to fix duplicate network requests after Fragment recreation?

Duplicate requests usually come from collectors or observers re-registered after recreation. Ensure Flow collection uses viewLifecycleOwner with repeatOnLifecycle, and make one-time events like navigation idempotent so they are not re-emitted.

Why does my app crash with view binding after onDestroyView?

The crash happens when an async callback updates views after the Fragment view is destroyed. Clear the binding reference in onDestroyView and scope async work to viewLifecycleOwner.lifecycleScope so it cancels when the view is gone.

Can this Skill debug process death and state restoration issues?

Yes, it covers process death and restore scenarios explicitly. It checks whether restorable state is stored in SavedStateHandle or onSaveInstanceState and recommends validation steps like killing the process and restoring during critical flows.

What are the limitations of using CodeGraph for lifecycle debugging?

CodeGraph does not reliably index XML layouts, data bindings, or AndroidManifest.xml entries like configChanges. For configuration-change or process-death bugs, supplement it with rg or find on manifest and layout files, and it works as an optional enhancement rather than a requirement.