<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kaushal Dhruw</title>
    <description>The latest articles on DEV Community by Kaushal Dhruw (@drulabs).</description>
    <link>https://dev.to/drulabs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F209289%2F1fe47acf-e1a5-4b19-9387-c8a1d60255a7.jpeg</url>
      <title>DEV Community: Kaushal Dhruw</title>
      <link>https://dev.to/drulabs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/drulabs"/>
    <language>en</language>
    <item>
      <title>Dependency Injection Diaries (1/3) — Get Rid of Hilt</title>
      <dc:creator>Kaushal Dhruw</dc:creator>
      <pubDate>Mon, 30 Nov 2026 14:00:56 +0000</pubDate>
      <link>https://dev.to/drulabs/dependency-injection-diaries-13-get-rid-of-hilt-i58</link>
      <guid>https://dev.to/drulabs/dependency-injection-diaries-13-get-rid-of-hilt-i58</guid>
      <description>&lt;p&gt;&lt;em&gt;How a weekend experiment to learn Metro ended with me removing Hilt from Google's Now in Android application, developing a reusable migration skill, and surprisingly improving startup performance.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And yes, I haven't written a single Metro annotation yet.&lt;/p&gt;

&lt;p&gt;Dependency injection is how an application supplies a class with the things it needs, rather than making the class construct them itself. Hilt had been handling much of that wiring for Now in Android; I wanted to see what taking ownership of it would involve.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;It started with curiosity&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;I wanted to spend some time catching up on three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Metro Dependency Injection&lt;/li&gt;
&lt;li&gt;Jetpack Compose&lt;/li&gt;
&lt;li&gt;Jetpack Glance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Naturally, I started building a completely useless Android application that combined train ticket booking, movie and show timings, and a recipe for Schezwan egg fried rice.&lt;/p&gt;

&lt;p&gt;Don't ask. There was never a product roadmap.&lt;/p&gt;

&lt;p&gt;The idea was to have unrelated features that would give me opportunities to experiment with modularization, dependency injection, navigation and different architectural patterns.&lt;/p&gt;

&lt;p&gt;But somewhere along the way, I asked myself a question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How much of what I learn from a small experimental application will actually translate to a large, multi-module Android codebase?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Having worked on large-scale Android migrations, I know that introducing a technology into a new project and replacing an established technology in an existing project are two very different engineering problems.&lt;/p&gt;

&lt;p&gt;I was more interested in the latter.&lt;/p&gt;

&lt;p&gt;Enter &lt;a href="https://github.com/android/nowinandroid" rel="noopener noreferrer"&gt;Now in Android&lt;/a&gt;, Google's actively maintained Android reference application.&lt;/p&gt;

&lt;p&gt;A substantial codebase with modularization, Compose, Navigation3, persistence, background processing, multiple build flavours and meaningful test infrastructure.&lt;/p&gt;

&lt;p&gt;Perfect.&lt;/p&gt;

&lt;p&gt;Except for one little problem.&lt;/p&gt;

&lt;p&gt;It uses Hilt.&lt;/p&gt;

&lt;p&gt;My primary interest was migrating conventional Dagger to &lt;a href="https://github.com/ZacSweers/metro" rel="noopener noreferrer"&gt;Metro&lt;/a&gt;. I wanted explicit components, subcomponents, scopes and factories to work with.&lt;/p&gt;

&lt;p&gt;So I decided to take a detour.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hilt → Plain Dagger → Metro&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;How difficult could the first arrow be?&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;Get rid of Hilt&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Before anyone reaches for their keyboard to defend Hilt, this is not an anti-Hilt article.&lt;/p&gt;

&lt;p&gt;Hilt solves genuine problems. It eliminates considerable Android-specific dependency injection boilerplate and provides standardized integration with Android framework components.&lt;/p&gt;

&lt;p&gt;My objective was to deliberately take ownership of those responsibilities so that I could study them during the subsequent Metro migration.&lt;/p&gt;

&lt;p&gt;I forked &lt;a href="https://github.com/drulabs/nowinandroid/tree/experiment/pure-dagger" rel="noopener noreferrer"&gt;Now in Android&lt;/a&gt;, created an experimental branch, and established a simple acceptance contract:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Preserve application behaviour.&lt;/li&gt;
&lt;li&gt;Preserve architectural and module boundaries.&lt;/li&gt;
&lt;li&gt;Preserve dependency ownership, scopes and lifetimes.&lt;/li&gt;
&lt;li&gt;Preserve existing user data and preferences.&lt;/li&gt;
&lt;li&gt;Preserve demo and production flavour configurations.&lt;/li&gt;
&lt;li&gt;Preserve meaningful tests.&lt;/li&gt;
&lt;li&gt;Avoid unrelated refactoring and dependency upgrades.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a user could tell that I had replaced the dependency injection infrastructure, something had probably gone wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;Before asking AI to write code, ask it to understand the problem&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;I used OpenAI Codex for much of the discovery, implementation, testing and documentation.&lt;/p&gt;

&lt;p&gt;Over the course of several large-scale migrations, I've developed a habit: I don't start by asking AI to implement something.&lt;/p&gt;

&lt;p&gt;I start by asking it to understand what it is about to change.&lt;/p&gt;

&lt;p&gt;The first phase of this experiment was entirely devoted to discovery. No application source code, build configuration or tests were to be modified.&lt;/p&gt;

&lt;p&gt;The agent was instructed to inventory Hilt usage, identify ordinary Dagger constructs that could be retained, inspect dependencies, consult official documentation, map alternatives, identify risks and categorize modules based on migration complexity.&lt;/p&gt;

&lt;p&gt;The discovery alone produced nine supporting documents.&lt;/p&gt;

&lt;p&gt;Eventually, we arrived at a seven-phase migration plan.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Phase&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Discovery&lt;/td&gt;
&lt;td&gt;Inventory, research, replacement mappings and module assignments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Foundations&lt;/td&gt;
&lt;td&gt;Establish plain Dagger conventions and migrate lower-complexity modules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Shared infrastructure&lt;/td&gt;
&lt;td&gt;Migrate data, persistence, network and service bindings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4. Feature integration&lt;/td&gt;
&lt;td&gt;Replace ViewModel creation and preserve lifecycle ownership&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5. Application cutover&lt;/td&gt;
&lt;td&gt;Replace application, Activity, worker and test graphs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6. Reconciliation&lt;/td&gt;
&lt;td&gt;Resolve temporary dependencies and cross-phase concerns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7. Final verification&lt;/td&gt;
&lt;td&gt;Audit source, dependencies, automated tests and application behaviour&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8p2abxsxus1ii1h083gl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8p2abxsxus1ii1h083gl.png" alt="Seven-phase Hilt to plain Dagger migration plan and verification practices." width="799" height="266"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The seven-phase Hilt-to-Dagger migration plan.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every phase required explicit authorization before execution.&lt;/p&gt;

&lt;p&gt;Every implementation phase produced a report documenting created, modified and deleted files, architectural decisions, automated test results, outstanding concerns and manual verification journeys.&lt;/p&gt;

&lt;p&gt;And no, a successful compilation was not sufficient to proceed to the next phase.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;Removing Hilt is not an annotation replacement exercise&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;This is where things started getting interesting.&lt;/p&gt;

&lt;p&gt;Much of the existing binding code was already ordinary Dagger. Constructor injection, &lt;strong&gt;&lt;em&gt;&lt;code&gt;@Binds&lt;/code&gt;, &lt;code&gt;@Provides&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;, qualifiers and assisted factories did not suddenly become obsolete because Hilt was being removed.&lt;/p&gt;

&lt;p&gt;The real work was replacing the infrastructure that Hilt generated and managed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application and Activity graphs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Explicit application component ownership, initialization order, Activity subcomponents and injection timing became our responsibility.&lt;/p&gt;

&lt;p&gt;Dependencies needed to retain their original lifetimes without accidentally introducing parallel singleton graphs or retaining destroyed Activities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ViewModel creation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This was one of the riskier parts of the migration.&lt;/p&gt;

&lt;p&gt;A constructor can receive the correct repository while the screen still gets the wrong ViewModel instance.&lt;/p&gt;

&lt;p&gt;Navigation3 ownership, ViewModelStore instances, navigation keys, assisted arguments, CreationExtras and saved-state restoration all needed to remain coherent.&lt;/p&gt;

&lt;p&gt;Simply replacing &lt;code&gt;***@HiltViewModel***&lt;/code&gt; would not achieve that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Background processing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A queued WorkManager request can outlive the application version that created it.&lt;/p&gt;

&lt;p&gt;Replacing the worker factory therefore required preserving existing worker identities, persisted input keys, unique-work names and scheduling policies.&lt;/p&gt;

&lt;p&gt;The migration had to consider work that might already be waiting to execute.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing infrastructure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hilt's test components and replacement modules also needed explicit alternatives.&lt;/p&gt;

&lt;p&gt;The application and the test had to receive the intended shared fake instances, while independently constructed test graphs needed to remain isolated.&lt;/p&gt;

&lt;p&gt;We added targeted tests for graph isolation, ViewModel owner and key reuse, state restoration and lifecycle cleanup.&lt;/p&gt;

&lt;p&gt;Eventually, the application's dependency injection architecture became what I had been looking for: an explicit Dagger application component, per-Activity subcomponents, lifecycle-aware ViewModel factories, assisted worker creation and separate test graph compositions.&lt;/p&gt;

&lt;p&gt;A little trip back to the good old Dagger days.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;Temporary should actually mean temporary&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Anyone who has worked on a large migration knows that compatibility layers are sometimes unavoidable.&lt;/p&gt;

&lt;p&gt;You cannot necessarily migrate every dependency consumer simultaneously.&lt;/p&gt;

&lt;p&gt;For example, removing &lt;code&gt;***@InstallIn***&lt;/code&gt; from a module while its consumers still depend on a Hilt-generated root graph can disconnect otherwise valid Dagger bindings.&lt;/p&gt;

&lt;p&gt;We introduced narrow compatibility adapters to keep the application functional throughout the intermediate phases.&lt;/p&gt;

&lt;p&gt;But I didn't want those adapters to become permanent residents of the codebase.&lt;/p&gt;

&lt;p&gt;So we maintained a &lt;strong&gt;temporary dependency retention register&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Every retained dependency or adapter needed to answer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why does it exist?&lt;/li&gt;
&lt;li&gt;Who depends on it?&lt;/li&gt;
&lt;li&gt;When should it be removed?&lt;/li&gt;
&lt;li&gt;What conditions make its removal safe?&lt;/li&gt;
&lt;li&gt;How will we verify that removal?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By the end of the migration, all eight retention entries were closed.&lt;/p&gt;

&lt;p&gt;Every temporary compatibility adapter had served its purpose and been removed.&lt;/p&gt;

&lt;p&gt;Technical debt isn't always avoidable. Unaccounted-for technical debt is.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;The AI session is disposable. Engineering knowledge isn't.&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;At one point during the migration, my AI session was approaching its context limit.&lt;/p&gt;

&lt;p&gt;Hundreds of thousands of tokens worth of architectural discussions, implementation decisions, failed approaches, test results and migration knowledge had accumulated.&lt;/p&gt;

&lt;p&gt;I would have loved to continue in the same session indefinitely.&lt;/p&gt;

&lt;p&gt;But that would have contradicted another objective of my experimentation with AI-assisted development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The accumulated intelligence must belong to the repository, not the AI session.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Throughout the migration, Codex maintained the living plan, discovery artifacts, replacement mappings, retention register, phase reports and architectural instructions.&lt;/p&gt;

&lt;p&gt;When the architecture changed, the repository's engineering knowledge changed with it.&lt;/p&gt;

&lt;p&gt;The migration reports explained how we arrived at the current architecture. &lt;code&gt;AGENTS.md&lt;/code&gt; described how the repository worked today.&lt;/p&gt;

&lt;p&gt;The intention was that a completely fresh AI session should be able to inspect the repository, understand the decisions already made and continue without requiring me to reconstruct the entire conversation.&lt;/p&gt;

&lt;p&gt;Session continuity should be a convenience, not a dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;Human in the loop — for a reason&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;I delegated much of the implementation and automated verification to AI.&lt;/p&gt;

&lt;p&gt;I did not delegate the entire acceptance decision.&lt;/p&gt;

&lt;p&gt;After every implementation phase, the agent provided concrete manual verification journeys with expected outcomes.&lt;/p&gt;

&lt;p&gt;I installed the migrated application and exercised those journeys myself.&lt;/p&gt;

&lt;p&gt;Navigation between different topic IDs, bookmarks and undo, search state, settings, rotation, deep links, existing-data startup, fresh installation, offline recovery and background sync.&lt;/p&gt;

&lt;p&gt;Importantly, we tested updates over existing application data rather than conveniently clearing storage whenever something changed.&lt;/p&gt;

&lt;p&gt;By the end of the weekend, the recorded results looked like this:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Measure&lt;/th&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Original module assignments addressed&lt;/td&gt;
&lt;td&gt;36/36&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Migration phases completed&lt;/td&gt;
&lt;td&gt;7/7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retention register entries closed&lt;/td&gt;
&lt;td&gt;8/8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Manual verification journey passes across phases&lt;/td&gt;
&lt;td&gt;30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Resolved dependency configurations audited&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hilt artifacts in audited configurations&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Observable behavioural regressions during manual verification&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Some modules required only verification, and some manual journeys were repeated across phases. These numbers are not a code coverage claim.&lt;/p&gt;

&lt;p&gt;Three previously recorded ForYou screenshot tests continued to fail. We did not independently establish identical pixel differences, nor did we modify assertions or regenerate screenshot baselines to make them pass.&lt;/p&gt;

&lt;p&gt;Production messaging, forced backend retry and device-wide process-death restoration remained outside the established verification evidence.&lt;/p&gt;

&lt;p&gt;I would rather have an honest report with documented limitations than an impressive-looking green dashboard that conceals them.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;And then came the unexpected part&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;I hadn't started this experiment to improve application performance.&lt;/p&gt;

&lt;p&gt;Nevertheless, with two working implementations available, curiosity got the better of me.&lt;/p&gt;

&lt;p&gt;I ran the existing Android Macrobenchmark startup tests against both implementations on my physical Pixel 9, running Android 17.&lt;/p&gt;

&lt;p&gt;The benchmark used 20 cold launches per compilation mode for each implementation.&lt;/p&gt;

&lt;p&gt;Here are the median results.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cold startup metric&lt;/th&gt;
&lt;th&gt;Hilt&lt;/th&gt;
&lt;th&gt;Plain Dagger&lt;/th&gt;
&lt;th&gt;Latency reduction&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;First frame — None&lt;/td&gt;
&lt;td&gt;409.65 ms&lt;/td&gt;
&lt;td&gt;302.01 ms&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;26.28%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First frame — Full&lt;/td&gt;
&lt;td&gt;421.21 ms&lt;/td&gt;
&lt;td&gt;317.33 ms&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;24.66%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fully drawn — None&lt;/td&gt;
&lt;td&gt;1,032.02 ms&lt;/td&gt;
&lt;td&gt;940.15 ms&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8.90%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fully drawn — Full&lt;/td&gt;
&lt;td&gt;960.60 ms&lt;/td&gt;
&lt;td&gt;812.06 ms&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;15.46%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkv0fjvnz1v21i3qxyp53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkv0fjvnz1v21i3qxyp53.png" alt="Cold startup latency medians comparing Hilt and plain Dagger on Pixel 9." width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Exploratory cold startup comparison on a Pixel 9.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The migrated application reached its first frame approximately &lt;strong&gt;104–108 milliseconds earlier&lt;/strong&gt; in both compilation modes.&lt;/p&gt;

&lt;p&gt;Perhaps the most interesting observation was that, under full precompilation, even the slowest recorded Dagger first-frame measurement (349.21 ms) was faster than the fastest recorded Hilt measurement (383.86 ms).&lt;/p&gt;

&lt;p&gt;I genuinely wasn't expecting that.&lt;/p&gt;

&lt;p&gt;However, before anyone concludes that removing Hilt makes Android applications 25% faster, there are some important limitations.&lt;/p&gt;

&lt;p&gt;These were exploratory measurements from one session per implementation, on one physical device. The execution order was fixed, battery and temperature conditions differed, and application state was not independently restored to an identical snapshot between sessions.&lt;/p&gt;

&lt;p&gt;The profile-guided Partial compilation mode was not measured either.&lt;/p&gt;

&lt;p&gt;Additionally, the Dagger build exhibited higher JIT compilation duration in the None mode, and greater fully drawn latency variability in the Full mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The observation is that this migrated application achieved lower startup medians in these particular runs. It is not proof that conventional Dagger universally outperforms Hilt.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Establishing repeatability would require additional counterbalanced sessions. Establishing causality would require deeper Perfetto trace analysis.&lt;/p&gt;

&lt;p&gt;Nevertheless, it's an interesting observation worth investigating further.&lt;/p&gt;

&lt;p&gt;Especially considering that performance improvement was never the original objective.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;The real deliverable: reusable engineering knowledge&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;After completing the migration, I extracted the accumulated knowledge into a self-contained &lt;strong&gt;&lt;a href="https://github.com/drulabs/nowinandroid/tree/experiment/pure-dagger/.daggering/dagger-only/skills/hilt-to-dagger-migration" rel="noopener noreferrer"&gt;Hilt-to-Dagger migration skill&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It contains guides for discovery and phasing, Dagger replacement recipes, and verification and closeout, plus templates for the plan, discovery record, phase reports and final report. Its core rules cover graph lifetimes, ViewModel ownership, queued work, test isolation and keeping intermediate builds runnable.&lt;/p&gt;

&lt;p&gt;It deliberately avoids Now in Android-specific paths, module counts and architectural assumptions.&lt;/p&gt;

&lt;p&gt;I didn't want a skill that could migrate Now in Android.&lt;/p&gt;

&lt;p&gt;I wanted a skill that could potentially migrate an Android application that neither the model nor I had encountered before.&lt;/p&gt;

&lt;p&gt;That distinction matters.&lt;/p&gt;

&lt;p&gt;I've always had a particular philosophy about AI-assisted software engineering:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Make the instructions so damn intuitive that even a 4-billion-parameter local model can execute them with ease.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Of course, that's not always possible.&lt;/p&gt;

&lt;p&gt;Frontier models are exceptionally valuable for architectural reasoning, discovery, questioning assumptions and resolving complex engineering problems.&lt;/p&gt;

&lt;p&gt;But once a problem has been understood and solved, why should every subsequent execution require the same amount of intelligence?&lt;/p&gt;

&lt;p&gt;Capture the decisions. Document the gotchas. Define the boundaries. Automate the deterministic parts. Provide meaningful verification mechanisms and explicit escalation paths.&lt;/p&gt;

&lt;p&gt;Turn previously solved reasoning problems into repeatable execution problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The mark of a great AI skill isn't how much intelligence it demonstrates. It's how little intelligence it requires.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whether this particular skill can achieve that ambition remains to be independently validated. It hasn't yet been evaluated against a small local model or an unfamiliar application.&lt;/p&gt;

&lt;p&gt;That's another experiment for another day.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;A productive weekend&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Somewhere between a few hundred thousand AI tokens, a nap, manual testing, an exhausted Codex usage allowance and Gradle attempting to turn my MacBook into a room heater, the experiment was complete.&lt;/p&gt;

&lt;p&gt;Incidentally, I own a T-shirt that says:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I've got 100 problems. Gradle is 99 of them.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This weekend did nothing to change my opinion.&lt;/p&gt;

&lt;p&gt;But the important outcome is that I now have a working, extensively documented, benchmarked conventional Dagger implementation of a substantial Android application.&lt;/p&gt;

&lt;p&gt;I have reusable migration knowledge, recorded architectural decisions, an established behavioural baseline and some unexpected performance observations.&lt;/p&gt;

&lt;p&gt;And I can finally get back to what I originally wanted to do.&lt;/p&gt;

&lt;p&gt;Learn Metro.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;u&gt;&lt;strong&gt;&lt;em&gt;Three things I’d take from this weekend&lt;/em&gt;&lt;/strong&gt;&lt;/u&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A DI migration is about ownership, not annotations.&lt;/strong&gt; Graph lifetimes, ViewModel reuse, background work and test isolation still have to behave correctly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep the engineering knowledge in the repository.&lt;/strong&gt; Plans, decisions, temporary adapters and verification results should survive the AI session that produced them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat surprising benchmarks as leads.&lt;/strong&gt; The startup results are worth investigating further, but these runs don’t prove that Dagger is universally faster than Hilt.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Coming next in Dependency Injection Diaries:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 2 — Get Rid of Dagger&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Migrate the explicit Dagger implementation to Metro, investigate incremental adoption and interoperability, compare performance, and extract another reusable migration skill.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 3 — The Generalization Test&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Take the accumulated knowledge to an independently developed Android application and find out whether the migration skill actually generalizes.&lt;/p&gt;

&lt;p&gt;Because making something work once is an experiment.&lt;/p&gt;

&lt;p&gt;Making it work repeatedly, in environments it wasn't specifically designed for, is engineering.&lt;/p&gt;

</description>
      <category>android</category>
      <category>dagger</category>
      <category>ai</category>
      <category>dependencyinjection</category>
    </item>
  </channel>
</rss>
