
Explore how Hilt enables dependency injection in Android with Kotlin, previewing the course from basics to modules, components, ViewModel, and unit testing.
Learn how the Udemy review system affects course visibility and how feedback from learners can help improve the content, with a focus on earning 5-star reviews.
Dependency injection is a design pattern, with dagger two and hilt offering easier, standardized and automatically generated components that decouple creation from usage and improve testability.
Master Dagger basics and how Hilt simplifies dependency injection in Android by removing the component and using modules with provides annotations. See how the system generates injection code for targets.
Set up Hilt in Android with Kotlin and explore constructor, field, and method injection while creating a new project in Android Studio, including the application class and entry points.
Create a new Android Studio project with an empty activity, set up hilt by adding the hilt android plugin and dependencies, and verify setup with the Android entry point annotation.
Create an application class and annotate it with HiltAndroidApp to provide a Hilt entry point, then declare it in the Android manifest.
Annotate classes with AndroidEntryPoint to declare where dependencies are injected and let Hilt generate components, while ensuring dependents are also annotated and avoiding retained fragments.
Discover constructor injection with hilt in Android, the simplest way to provide a dependency via an annotated constructor to the dependency graph for injection wherever needed.
Learn field injection with Hilt in Android and Kotlin, injecting a database adapter into an Android entry point to decouple instantiation and enable easy unit testing.
Learn method injection in Hilt, injecting objects directly into a method call with a database service example. Compare it to constructor and field injection as the foundation for Hilt.
Explore Hilt dependency injection in Android with Kotlin by setting up a mock network service using a builder pattern, interceptors, and interfaces to demonstrate module-based injection.
Learn how Hilt modules define instantiation for types not easily constructor-injected, including interfaces and third-party types, and bind them in the activity scope via a network module.
Inject interfaces with Hilt by binding a network adapter interface to its implementation using @Binds in an abstract module, enabling interface-based dependency injection in activities.
Use the provides annotation to inject instance-based dependencies like a network service via a network module, enabling Hilt to supply complex or third-party types into activities.
Use Hilt qualifiers to differentiate bindings of the same interface. Define qualifier annotations, apply them in modules, and inject either a call interceptor or a response interceptor.
Explore how Hilt provides Android context via predefined qualifiers, including application and activity context, and injects them into constructors like a database adapter, with lifecycle cautions.
Learn how to install a single Hilt module into multiple components in the same file, making the same functionality available across the activity and view components without duplication.
Explore Hilt components, their lifetimes, and scopes to understand how bindings are created and where they are available across application, activity, and fragment scopes, including singletons.
Explore how Hilt automates component generation, matching bindings to scopes from application to fragment, and understand lifetimes to ensure bindings are available where needed.
Explore how Hilt scopes control object creation, from unscoped bindings to singleton and activity scoped instances, and learn to apply activity or application scope for shared network services.
Explore the component hierarchy in Hilt dependency injection, showing how bindings flow from the top application component to activity and fragment scopes, and how scopes affect access.
Learn to use hilt with viewmodels, set up AndroidX hilt dependencies, and inject a stats view model that emits live data every 500 ms for observation in main activity.
Unit test a database adapter by mocking context and database service with Mockito, and see how Hilt enables testing of separate components.
Apply Hilt dependency injection in your Android apps, practice as much as you can, and note how Hilt is replacing Dagger and shaping future implementations.
Dependency Injection is now an indispensable component of Android development. All well built, large projects use it to make development easier and more practical.
Hilt is the next generation dependency injection framework from Google. It's built on top of Dagger and simplifies DI greatly. Android development has been steadily relied upon Dependency Injection, and Hilt is now the fastest and simplest way to implement it in your projects.
This course will
take you from a complete beginner in the technology
explain in detail the theoretical aspects of Hilt injection
exhaustively go through all the components that make Hilt such a successful library
implement it in a practical application
After this course you will have the knowledge and experience to use Hilt in all your app development projects, and will allow your apps to grow and expand seamlessly.
We will learn about:
Modules
Constructor injection
Field injection
Method injection
Components
Qualifiers
Standard qualifiers
ViewModel injection
Unit testing
We will build everything in Kotlin.
We cover a lot of ground in this course, and we will implement the concepts practically so that you get not only theoretical knowledge but practical experience as well. Whether you start with zero experience in dependency injection or you already know a little bit about it through dagger, this course will show you how to use it with Hilt.
Sign up today, and let's learn how to use Hilt to build a modern Android Application.