Dagger 2 @Inject & @Component Tutorial - CheezyCode (Hindi) #3
HTML-код
- Опубликовано: 9 янв 2025
- Learn Dagger 2 @Inject & @Component Annotations. This video covers - how Dagger2 creates the required objects for you, what is component in Dagger 2, what is the use of @Inject annotation. Learn how dagger does constructor injection in Android. Learn all about this in Hindi.
Topics covered -
1. What is @Component in Dagger2 Android?
2. What is @Inject Annotation in Dagger?
3. Implement Constructor Injection in Dagger2
4. Complete Example of Dagger 2 in Android.
Complete Dependency Injection Playlist Link -
• Dagger 2 - Dependency ...
Complete Android Architecture Components Playlist -
• Android Architecture C...
Beginner series in Android Playlist (Hindi) -
• Android Tutorials Step...
Kotlin Beginners Tutorial Series -
• Kotlin Beginner Tutori...
For more info - visit the below link
www.cheezycode.com
We are social. Follow us at -
Facebook - / cheezycode
Twitter - / cheezycode
Instagram - / cheezycode
Very well explained sir, thank you very much ;) Hindi mai sab thik se samaz aata hai, aur aap repeat bhi karte hai, plus visuals se bhi batate hai, thank you very much
Thank you Nilesh
your best thing is you finish the topic in short video and add only related things and example that make video more understandable
love the way of presenting content 💙💙
I just wanted to take a moment to express my gratitude for all the knowledge and guidance you have provided me in my journey as an Android developer.
Your lessons have been incredibly valuable and have helped me grow both professionally and personally. I truly believe that your teachings have been instrumental in shaping me into the developer I am today.
Thank you for being an amazing teacher♥❤🙏🙏🙏🙏🙏
Cheers man 😊 🙏
Simply great! Hats off to you Sir.
Your way of explanation, mind blowing!
Great Tutorials 🔥🔥🔥
Great explanation sir 🙏
Thanks and welcome
Best dragger tutorial. Thnaks Sir
Thank you 😊
Sir very well explaination
Thanks for these amazing tutorials. 🙏
Thank you 👍
A very great tutorial bhai!! Keep it up!!
However, I have a question, agar Consumers ko @Inject karke annotate kia jata h(Consumers as it means it will be consuming the objects), to sabse pehle humne UserRegistrationService Class par @Inject kyu kia in the context ki UserRegistrationService ka object banana h? Is Class par @Inject Annotate karne ka matlab to ye hua ki isko object mil rha hoga and ideally, Inject to MainActivity ko hona chahiye kyunki vo consumer h?
Great Tutorial Sir, Can you please provide a starter project so we can work on it as we go through the playlist? Thank you🙏
you can refer the new series or you can refer the github of this repo with MVVM and Retrofit - github.com/CheezyCode/DaggerMVVM
very nice
last music in video...amzinggg
Jaldi publish karte hai
thank you very much
Nicely explained.
Thanks Nikhil 😊
Than you
Very very thanks
Thank you too!
Good
Is this injection use in java
Yes...same implementation
Thanks
Thank you sir
Thank you Samir
your videos are amazing but my DaggerUserRegistrationComponent class is not generated..
UserRegistrionComponent not make my Class why...?
sir i am following your video, i am facing problem in this time that is kapt in dependency showing error and when i use annotation dependency instead of kapt dependency it works fine but getting problem in when i call this class "DaggerUserRegistrationServices". sir help me what should i do now?
+1
implementation 'com.google.dagger:dagger:2.45'
kapt 'com.google.dagger:dagger-android-processor:2.45'
kapt 'com.google.dagger:dagger-compiler:2.45'
Use this dependency for dagger and kapt , it fixed my problem
Try this whith implementation (" ") instead of kept(" ")
annotationProcessor 'com.google.dagger:dagger-compiler:2.40.5'
even mvvm architecture was easy to learn but dependancy injection is hard to understand , complex topic It is
It is easy...just think before you jump to another video...why I did it the way I did it...what's the benefit do we get by writing code like this - just think for a moment...try to write down your problems, your thoughts on each concept. It will start making sense..
Still stuck - write down in comments for me...I will help you out
need video on kmm
So using inject dagger knows what kind of object to build. Is that right?
Using Inject helps dagger to build that particular object. It is a way to tell Dagger that if you need X object - use this constructor annotated with @Inject.
One more use case of @Inject will be covered in next video.
@@CheezyCode understood sir and thank you for uploading such advance topics. 👍🏻
sir java mein bhi bna den tutorial
Where can I get the source code to understand more about this ?
CheezyCode GitHub profile
is hilt also comming ?
Hopefully yes
🙏🏻
can you please upload the code in github
Already did
@@CheezyCode Link?
component class is not building
Add this to dependencies
implementation ("com.google.dagger:dagger-android-support:2.50")
@ - at
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
getting this error
When I built my code , I Got this error .
So I am unable to use DaggerUserRegistrationServiceComponent.
I need your help sir.
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message)
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
Rebuild once
@@CheezyCode I got same error once again after rebuild
Not sure...need to check - you can refer the codebase on GitHub.com /cheezycode / dagger examples
@Rosan Nepal
Please use this below code, I was facing same issue. Now it is working fine.
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
implementation 'com.google.dagger:dagger:2.25.3'
kapt 'com.google.dagger:dagger-android-processor:2.25.3'
kapt 'com.google.dagger:dagger-compiler:2.25.3'
You probably don't need this anymore so commenting for other people, replace the kapt 'com.google.dagger....' with annotationProcessor 'com.google.dagger....' That fixed it for me.
Thanks for these amazing tutorials. 🙏
Thanks