Clean-Room Reimplementation of a Mobile App in 7 Hours for $21

    This article explains how to reimplement a mobile app through clean-room methods in roughly 7 hours at a cost of about $21, using only publicly observable UI and interaction results—no decompilation, reverse engineering, or capture of private traffic. It introduces an L0–L5 fidelity grading model that turns vague "make it look the same" requests into verifiable acceptance criteria, then walks through a five-step workflow: on-device inspection via debugging bridges, UI semantic parsing from control trees plus screenshots, specification tables for per-screen differences and behavior audits, native client rebuild driven by design tokens and explicit state machines, and server rebuild validated by side-by-side comparison on the same device. It also covers common pitfalls, how to package the experience into a reusable skill kit, and the compliance boundaries that keep clean-room work within public and lawful scope.

    1. Background and Problem Definition: Why Reimplementing an App Is Not Copying a UI

    In mobile application development, we often run into a specific kind of request: all you have is a phone with the target app installed—no source code, no API documentation—yet you need to deliver a working product that closely matches its functionality and experience in as little time as possible. This kind of request typically shows up in legitimate scenarios such as competitor feature research, interaction pattern validation, internal prototype pre-development, and teaching demos.

    One case mentioned in the original practice: a developer used an AI coding tool together with an “investigate—rebuild—verify—deliver” methodology to produce a high-fidelity reproduction of an AI creation app with image generation, video generation, video editing, and duration extension capabilities—in about 7 hours and at a cost of about 21 yuan. The developer open-sourced both the Android native client and the server side, along with a reusable skill package for further development by others.

    What needs to be emphasized is that this article discusses clean-room reimplementation: observing only publicly visible interfaces and interaction results, with no decompiling, no reverse engineering, and no capture of private communication content—writing your own code from scratch. This is both the compliance baseline and the more robust engineering path, because implementation details obtained through reverse engineering tend to be fragile and hard to maintain.

    The original text also mentions an interesting aside: someone in the comments asked whether a certain free short-drama app could be reimplemented, and the author dodged with “I don’t know about it,” only later turning to the reproduction of an AI generation product. This suggests that the prerequisite for reimplementation is observability of the target, not courage.

    2. Grading Reimplementation Difficulty: L0 to L5, Turning “How Similar” into Acceptance Criteria

    The biggest trap in reimplementation is that both sides define “done” differently. So the first step must be difficulty and fidelity grading, converting vague demands into a checkable list:

    • L0 static resemblance: only screenshot-level similarity of static pages, with hardcoded data.
    • L1 clickable interaction: buttons are clickable and pages navigate, but state is not real.
    • L2 data flow: connected to a self-built service, with lists and details coming from real requests.
    • L3 consistent results (default tier): core flows work end to end, and output quality is comparable to the original.
    • L4 consistent boundaries: behavior of branches such as exceptions, empty states, weak networks, and permission denial is aligned.
    • L5 full alignment: multi-platform, multi-language, accessibility, and performance baselines are all aligned.

    Defaulting to L3 and explicitly “rejecting static fake data” is the key decision for controlling the schedule. Chasing L5 from the start makes costs rise exponentially; stopping at L0 leaves you with a deliverable that has no verification value.

    3. The Five-Step Framework: From On-Device Observation to Rebuilding Both Ends

    1. Direct Device Connection: Use Debug Bridging Instead of Reverse Engineering Tools

    Enable developer options and USB debugging on the target phone, and let the computer communicate with the device through the platform’s built-in debug bridge tool. In this step, the AI coding tool acts as a “terminal dispatcher”: it does not understand the phone, but it can reliably execute commands, collect artifacts, and summarize differences.

    Common capabilities include: listing installed package names, launching a specified screen, exporting the UI hierarchy, capturing screen pixels, simulating taps and swipes, and reading runtime logs. Example command forms are as follows (illustrative only, with no third-party tool names involved):

    1. # List third-party packages to locate the target app identifier
    2. shell pm list packages -3
    3. # Launch the target screen
    4. shell am start -n <package>/<activity>
    5. # Export the current screen's control tree
    6. shell uiautomator dump /sdcard/ui.xml
    7. # Capture the current screen
    8. shell screencap -p /sdcard/s.png

    The engineering point of this step is reproducibility: script all observation actions so that any “observed phenomenon” can be triggered again—otherwise the later verification phase has nothing to stand on.

    2. UI Semantic Parsing: Control Trees Give Structure, Screenshots Give Visuals

    Relying on screenshots alone only gets you “good-looking”; relying on control trees alone only gets you “structure.” The two must be layered together:

    • The control tree provides control types, text, clickability, boundary coordinates, and hierarchy—the skeleton for restoring layout and interaction;
    • Screenshots provide color schemes, corner radii, shadows, font size hierarchy, icon style, and spacing rhythm—the skin and flesh for restoring the visuals.

    In practice, it is recommended to produce two artifacts for each screen and build a mapping table from coordinates to components, avoiding “writing dp values by feel.” For self-drawn content (such as generation result cards and player controls), the control tree is often sparse in information; in that case, sample colors from screenshots and infer gesture semantics through multi-point touch experiments.

    3. Specification Lists: Turning Observations into Engineering Input

    This step is the turning point from “having looked” to “being able to write,” and it requires two core tables:

    Per-screen UI difference table (example structure)

    Screen Component Original feature Reimplementation Difference verdict
    Home Top notice bar 16dp corner radius, semi-transparent mask Implemented with the same values Consistent
    Project page Card grid Two columns, 12dp spacing Implemented with the same values Consistent

    Behavior audit table (example structure)

    Trigger action Precondition state State change Failure branch
    Tap generate Reference image selected Enter queued state and show progress If quota is insufficient, prompt and block
    Extend video A completed clip exists Append duration and keep original image attribution If the network drops, keep the original clip

    The value of the behavior audit table is that it forces you to write out “hidden branches.” Most reimplementation projects fail not because the main flow is unlike the original, but because empty states, failure states, secondary confirmations, and rollback paths were not built.

    4. Native Client Rebuild: Structural Fidelity Before Pixel Fidelity

    For the native client, a declarative UI approach is recommended for maintainability and state-driven capability. The recommended rebuild order is: design tokens (colors, font sizes, corner radii, spacing) → common components (buttons, cards, bottom navigation) → screen skeletons → state management → animation details.

    Illustrative code (pseudocode style, used to explain design tokens and state-driven thinking):

    1. // Centralize design tokens to avoid magic numbers scattered around
    2. object Tokens {
    3. val radiusCard = 16.dp
    4. val gapGrid = 12.dp
    5. val colorMask = Color(0x66000000)
    6. }
    7. // Express the generation task with an explicit state machine, avoiding "boolean flags everywhere"
    8. sealed interface GenState {
    9. data object Idle : GenState
    10. data class Queued(val progress: Float) : GenState
    11. data class Done(val assetId: String) : GenState
    12. data class Failed(val reason: String) : GenState
    13. }

    Key lesson: align the state machine first, then align the pixels. If the state machine is wrong, the UI is an empty shell no matter how similar it looks; if the state machine is right, visual differences can be converged in one design review pass.

    5. Server Rebuild and Same-Device Acceptance

    The server only implements capabilities actually called by the client, typically including: task creation, task query, artifact storage and distribution, quota and rate limiting, and error code conventions. Generation capabilities can integrate with a general-purpose model service, using queues for peak shaving, asynchronous callbacks, and retry strategies to ensure stability; artifacts are best placed in object storage and delivered with a content delivery network; logs and metrics can be connected to logging services and monitoring alerts to help locate failure rates and latency tails.

    Acceptance insists on “same-device comparison”: the same device, the same network, the same input, running the original and the reproduction side by side, checking off the difference table item by item. The high-fidelity comparison collection idea mentioned in the original text fits here: home page versus project page comparison, editing and parameter settings comparison, and result-level validation—real model proxy participation, full-duration playback, and multiple versions retained without losing original image attribution.

    4. Common Pitfalls and How to Avoid Them

    1. Taking observability for granted: some screens render in degraded mode on low-end devices, so cross-validate across multiple device tiers.
    2. Ignoring permissions and lifecycle: backgrounding, rotation, and permission denial all change state branches.
    3. Losing attribution of asynchronous results: multi-version generation must bind the source image and parameter snapshot, otherwise it cannot be reproduced.
    4. Insufficient one-time scripting: if observations cannot be replayed, the verification phase falls apart.
    5. Optimizing visuals too early: get end-to-end working first, then do pixel-level polish.

    5. Reusability and Secondary Development

    Consolidate the experience into a skill package containing: grading templates, an observation script checklist, difference table and audit table templates, state machine patterns, and acceptance scripts. Then host both the native client and the server on a code hosting platform so others can learn from it or adapt it for similar AI generation products. Engineering recommendations include: contract-first interfaces, feature flags with gradual rollout, and a regression set of failure samples.

    6. Conclusion

    The 7-hour, 21-yuan cost was possible not because the tools are magical, but because the method was structured: grade first, then observe, then specify, rebuild both ends, and verify on the same device. This path transfers to feature pre-research for tool, content, and e-commerce apps, and can serve as a standard step in internal team prototype reviews. It bears repeating that clean-room reimplementation should always stay within publicly observable scope and lawful, compliant uses, respect intellectual property and terms of service, and invest creativity in differentiated capabilities for your own product.