Thanks you for your content. You should consider placement of yourself in the video as it blocks needed info and can create problems with people following along.
What code you have written in BaseApi which extends in AuthApi interface? I have one suggestion if you don't mind. You are very good instructor thanks for taking saperate example for each concept. But before starting the tutorial can you go through all files inside java package? so that everyone will understand the code in each file. Because after long time the code is not available on server. Thanks.
fun provideAuthRepository(remoteDataSource : RemoteDataSource) : AuthRepository{ return(AuthRepository(remoteDataSource.buildApi(AuthApi::class.java),context),UserPrefences(context)) } will this code work or not. I did so because AuthRepository also can't be constructor injected and AuthRepository can't be constructor injected because it has two constructor parameter AutApi and UserPrefences).
Its very simple, you should watch it from the first video. Check here: bit.ly/3sy0Ghp I would like to give you the basic idea. Dagger's goal here is to provide dependency. And first we will try to constructor inject everything. So if a class is annotated with @Inject, that means dagger can provide it's instance. The condition is all the if there are any class in the constructor parameter, those classes should also have @Inject because dagger needs to know how to build it. for example. class A @Inject constructor(b: B) B should also have @Inject class B @Inject constructor() Once your classes satisfy this condition, you can inject them using @Inject. For example in an Activity you can write @Inject lateinit var a: A; This is how we inject dependencies. And when we call the function inject() from AndroidInjection all the variables annotated with @Inject are injected. Now another thing to note is, it is not always possible to write @Inject in constructor. What if the class you want is from a library or it is an interface. You cannot write @Inject in constructor then. For this case you can create a Module, that will tell dagger how to provide these instances. I hope you understood. Thanks
@@SimplifiedCoding I know you keep saying it’s very simple but honestly it’s not, it’s one of the most complex and confusing topics on Android. It’s a series of hacks and workarounds that requires you to fully and intimately understand the Andriod way of handling things. The whole system is in need of scrapping and starting over due to the numerous workarounds and bug fixes and patches. Andriod is definitely showing its age with the level of complexity needed to just do very simple things like provide an object in a scope. We are attempting to do things that the platform was never designed to do and it’s so messy and confusing that nearly everyone gets it wrong. Thank you for the enhanced explanation, and I do understand the basics but the advanced topics are very confusing.
@@SimplifiedCoding yes, ive been studying hilt for a couple of months and Hilt is definitely an improvement over Dagger as far as understandability and comprehension is concerned. It does have limitations for creating a multi-moduile (not dagger modules, but Android modules). You must still use Dagger if you want to make your app modular... its also very confusing the overloading of these terms in the same domain... I'm sure all this confusion and complexity has made budding Android developers quit and move on to flutter or React or iOS! :)
I like the way we get to know the dagger impl in while real project scenario impl ....it gives a real hands-on on live projects alot . Keep going. Later if u could also make bdd testcase vedio that would be helpful... replacing UI testcases
Hey mate, the gihub link for this project seems to be incorrect, also there is just one branch (master), which is an implementation of Dagger Hilt. Can you update the branches for this video ? Thanks
When did I say I cannot use hilt? 🤔🤔 Next video will be about Hilt. This course is about dependency Injection from scratch. Here I am covering from manual dependency injection to dagger to hilt. So that you get to know everything. ✌️
Thanks you for your content. You should consider placement of yourself in the video as it blocks needed info and can create problems with people following along.
Yeah, thats why I am not putting my face in new videos.
just want to leave a comment of appreciation.. im learning a lot from your videos.. please continue to your good work sir.. more power 😁 👍
What code you have written in BaseApi which extends in AuthApi interface? I have one suggestion if you don't mind. You are very good instructor thanks for taking saperate example for each concept. But before starting the tutorial can you go through all files inside java package? so that everyone will understand the code in each file. Because after long time the code is not available on server. Thanks.
fun provideAuthRepository(remoteDataSource : RemoteDataSource) : AuthRepository{
return(AuthRepository(remoteDataSource.buildApi(AuthApi::class.java),context),UserPrefences(context))
}
will this code work or not. I did so because AuthRepository also can't be constructor injected and AuthRepository can't be constructor injected because
it has two constructor parameter AutApi and UserPrefences).
Functionality needs to be explained not just syntax
Honestly I’m more confused now
Its very simple, you should watch it from the first video.
Check here: bit.ly/3sy0Ghp
I would like to give you the basic idea.
Dagger's goal here is to provide dependency. And first we will try to constructor inject everything.
So if a class is annotated with @Inject, that means dagger can provide it's instance. The condition is all the if there are any class in the constructor parameter, those classes should also have @Inject because dagger needs to know how to build it.
for example.
class A @Inject constructor(b: B)
B should also have @Inject
class B @Inject constructor()
Once your classes satisfy this condition, you can inject them using @Inject.
For example in an Activity you can write
@Inject lateinit var a: A;
This is how we inject dependencies. And when we call the function inject() from AndroidInjection all the variables annotated with @Inject are injected.
Now another thing to note is, it is not always possible to write @Inject in constructor. What if the class you want is from a library or it is an interface. You cannot write @Inject in constructor then.
For this case you can create a Module, that will tell dagger how to provide these instances.
I hope you understood. Thanks
@@SimplifiedCoding I know you keep saying it’s very simple but honestly it’s not, it’s one of the most complex and confusing topics on Android. It’s a series of hacks and workarounds that requires you to fully and intimately understand the Andriod way of handling things. The whole system is in need of scrapping and starting over due to the numerous workarounds and bug fixes and patches. Andriod is definitely showing its age with the level of complexity needed to just do very simple things like provide an object in a scope. We are attempting to do things that the platform was never designed to do and it’s so messy and confusing that nearly everyone gets it wrong.
Thank you for the enhanced explanation, and I do understand the basics but the advanced topics are very confusing.
I understand your feeling. 😄 But things are getting simpler. Have you checked the next video that is about hilt?
@@SimplifiedCoding yes, ive been studying hilt for a couple of months and Hilt is definitely an improvement over Dagger as far as understandability and comprehension is concerned. It does have limitations for creating a multi-moduile (not dagger modules, but Android modules). You must still use Dagger if you want to make your app modular... its also very confusing the overloading of these terms in the same domain... I'm sure all this confusion and complexity has made budding Android developers quit and move on to flutter or React or iOS! :)
Can we use dagger hilt instead of using dagger2? I think that dagger hilt is very easy to implement. Am i wrong?
Yes, hilt is easy. Just wait for the next video.
Ya am eagerly waiting for your every video. Thanks for the tutorial. :)
I like the way we get to know the dagger impl in while real project scenario impl ....it gives a real hands-on on live projects alot . Keep going. Later if u could also make bdd testcase vedio that would be helpful... replacing UI testcases
I like this series. 👏
Thank You Manish
Hey mate, the gihub link for this project seems to be incorrect, also there is just one branch (master), which is an implementation of Dagger Hilt. Can you update the branches for this video ? Thanks
Hi belalkhan , why you are not using scrcpy for showing your screen phone? That's very cool , i hope helping you ! Good luck
Can somebody explain to me why I cannot define "DaggerAppComponent" inside my Application class
Why you cant use hilt that is very easy
I use HIlt and now it seem very hard
When did I say I cannot use hilt? 🤔🤔
Next video will be about Hilt. This course is about dependency Injection from scratch.
Here I am covering from manual dependency injection to dagger to hilt.
So that you get to know everything. ✌️
@@SimplifiedCoding i mean dagger is so hard and thats why this video very confusing
I am waiting for hilt
Next and the last video of this course is about hilt. ✌️ cheers
very nice video.
Why not Hilt?
Wait for next video.
Is there still a reason to use Dagger instead of HILT in new projects?
Feature modules don't support HILT yet
Oustanding!
In which company you are working ?
Lol... Thank goodness we don't have to use Dagger2 anymore