Alternatives to Dagger 2 in Android development?

Android dependency injection alternatives, Android DI frameworks, Hilt, Koin, Toothpick
Explore popular alternatives to Dagger 2 for dependency injection in Android development, including Hilt, Koin, and Toothpick.

// Example using Hilt for dependency injection in Android
@dagger.hilt.android.HiltAndroidApp
class MyApplication : Application()

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
    @Inject lateinit var repository: Repository // Injecting the dependency

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Use repository in your activity
    }
}
    

Android dependency injection alternatives Android DI frameworks Hilt Koin Toothpick