# Android Leak Expert

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-josephsanjaya-skills-android-leak-expert`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [JosephSanjaya](https://agentstack.voostack.com/s/josephsanjaya)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [JosephSanjaya](https://github.com/JosephSanjaya)
- **Source:** https://github.com/JosephSanjaya/skills/tree/main/android-leak-expert

## Install

```sh
agentstack add skill-josephsanjaya-skills-android-leak-expert
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Android Leak Expert

Identify, profile, and fix memory leaks in Android applications (Java, Kotlin, Jetpack Compose, JNI).

Symmetrically unbind resources in lifecycles, collect flow streams lifecycle-aware, use static classes with WeakReference for background work, and manually clear native/JNI references.

## 1. Quick Decision Tree
- **Suspicious code scan** → Run scan script (`scripts/scan_leak_vectors.py`)
- **Profile memory / investigate heap dump** → Heap Profiling & Dominator Trees ([references/debugging_and_solutions.md#2-heap-diagnostics--profiling](references/debugging_and_solutions.md#2-heap-diagnostics--profiling))
- **Fix classic view/fragment leak** → Teardown & Lifecycle Binding ([references/debugging_and_solutions.md#3-classic-leak-patterns--solutions](references/debugging_and_solutions.md#3-classic-leak-patterns--solutions))
- **Fix Compose/flow state leak** → Compose Flow Collection & Effect Cleanups ([references/jetpack_compose.md](references/jetpack_compose.md))
- **Fix native C++/JNI leak** → Native JNI Frame & Registry Release ([references/debugging_and_solutions.md#4-jni-native-memory-management](references/debugging_and_solutions.md#4-jni-native-memory-management))
- **Set up CI/CD verification** → Trap-Tests & JUnit RuleChains ([references/debugging_and_solutions.md#5-enterprise-scale-observations](references/debugging_and_solutions.md#5-enterprise-scale-observations))
- **Now In Android reference** → View code patterns ([references/nowinandroid.md](references/nowinandroid.md))

## 2. Fast Command Tools
Scan target code directory for common memory leaks:
```bash
python3 scripts/scan_leak_vectors.py 
```

## 3. Clean Code Reference Implementations
- **Safe Handler Pattern**: [SecureHandlerSample.kt](assets/SecureHandlerSample.kt)
- **Safe Fragment Adapter Binding**: [SecureFragmentSample.kt](assets/SecureFragmentSample.kt)
- **Safe Compose Lifecycle**: [SecureComposeLifecycleSample.kt](assets/SecureComposeLifecycleSample.kt)

Developers must follow these rules. Ensure all custom handlers are static, fragments should nullify bindings/adapters in onDestroyView, and compose collections must only use collectAsStateWithLifecycle.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [JosephSanjaya](https://github.com/JosephSanjaya)
- **Source:** [JosephSanjaya/skills](https://github.com/JosephSanjaya/skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-josephsanjaya-skills-android-leak-expert
- Seller: https://agentstack.voostack.com/s/josephsanjaya
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
