explaingit

square/dagger

7,284JavaAudience · developerComplexity · 3/5Setup · moderate

TLDR

A deprecated Java and Android library from Square that automatically wires up dependencies between classes at build time. Replaced by Dagger 2, only useful today for maintaining legacy codebases.

Mindmap

mindmap
  root((square/dagger))
    What it does
      Dependency injection
      Wires classes at build time
      Two-jar distribution
    Audience
      Legacy Android devs
      Java backend maintainers
    Setup
      Maven Central jars
      Runtime jar
      Compiler jar
    Status
      Deprecated
      Migrate to Dagger 2
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Maintain a legacy Android or Java app that still depends on Dagger 1 without migrating to Dagger 2 yet

USE CASE 2

Study how early Android dependency injection worked before Dagger 2 existed

USE CASE 3

Add the two Dagger 1 Maven Central jars to an existing Maven project to get dependency injection running

Tech stack

JavaAndroidMaven

Getting it running

Difficulty · moderate Time to first run · 30min

Deprecated with no active maintenance, add the runtime and compiler jars from Maven Central, then follow the official Dagger 2 migration guide.

In plain English

Dagger 1 is a deprecated Java and Android library from Square that handled dependency injection, which is a programming pattern for automatically supplying objects with the other objects they need to function. Rather than having each class manually create or locate its dependencies, a dependency injection framework wires everything together at build time or startup. This repository is no longer actively maintained. Square and Google jointly moved to Dagger 2, which is a separate project hosted under Google's GitHub account. The README explicitly directs anyone still using this version to migrate, and provides a link to a migration guide. For anyone who needs to work with the old version for legacy reasons, it was distributed as two jar files: a runtime jar that ships with the application, and a compiler jar used only during the build process to generate the wiring code. Installation instructions are provided for Maven-based projects, and the compiled jars were also available on Maven Central. The primary audience for this repository today would be developers maintaining older Android or Java applications that have not yet upgraded to Dagger 2, or historians of Java tooling interested in how dependency injection evolved in the Android ecosystem. New projects should not use this version.

Copy-paste prompts

Prompt 1
Show me how to convert a Dagger 1 @Module and @Inject setup to the equivalent Dagger 2 @Component structure using the migration guide.
Prompt 2
Write a Dagger 1 @Module class that provides a NetworkClient and a UserRepository to an Android Activity via @Inject.
Prompt 3
List the Maven pom.xml dependency entries I need to add to use Dagger 1 runtime and compiler jars from Maven Central.
Prompt 4
What are the key differences between Dagger 1 and Dagger 2, and what should I change first when migrating a legacy Android app?
Open on GitHub → Explain another repo

← square on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.