Over time, a few things changed in regards to dagger hilt. I made a new video in which I cover the most up to date things and also some more concepts I didn't cover in this one: kzbin.info/www/bejne/mJOwpKh_Z9VkerM
@fb7673 жыл бұрын
Also, note that ApplicationComponent has been replaced with SingletonComponent. ApplicationComponent will now cause a unresolved reference error.
@vamsireddy75603 жыл бұрын
Yes ! ApplicationComponent is Deprecated in new Version of Dagger then we have Instead use SIngletonComponent
@osmanmusse94322 жыл бұрын
thanks
@yarivzip2 жыл бұрын
@@vamsireddy7560 but how do you annotate the dependency itself if the class is a singleton and you want it to only exist at activity level?
@pqsk2 жыл бұрын
@@yarivzip I believe that's ActivityComponent
@durbie903 жыл бұрын
Please don't ever stop making videos. Every time I watch one of your videos I get an Aha! Moment. Learning so much from you.
@livlop4 жыл бұрын
This is really a complete video about Dagger Hilt and very easy to understand, as Philipp started to explain "if you want to inject 2 strings", you can realize that this video is better than others on KZbin and in the same way it has enough fundamentals concepts of Hilt so you can start the implementation in your application. Really thanks Sir 🤜🤛
@aravindhsamidurai53003 жыл бұрын
This is an awesome video to easily understand Hilt. Even Google developers also don't teach like this. Thanks a lot, @Philipp Lackner for making this video.
@mikemikee77974 жыл бұрын
Android file system could be also a good candidate for "in detail" video ^^
@bjugdbjk3 жыл бұрын
This video clarified my many questions on Hilt and you have such a great skill of explaining complex things pretty simple way. Thanks again.
@Mikerandria2 жыл бұрын
I wish every tutorial on KZbin would be on this level! Too clean.
@Another0neTime4 жыл бұрын
I was just reading a cheat sheet to get familiar with the annotations, then you upload this awesome video. Thanks!!!
@aayushsarikhada62 жыл бұрын
Can you please provide me that cheat sheet please 👍
@sustainabilitybeauty3318 Жыл бұрын
Thank you philip, the annotation @Named one helps me to deal with the problem with multiple BASE URL, Thankkk uuuu
@mkc03213 жыл бұрын
why people dislike such amazing videos ? i think its youtube algorithim which does it automatically
@jeckonly58532 жыл бұрын
i come back again!! thanks phillipp 😀Actually , you give me a lot help in Android dev!!
@abbasadrali3 жыл бұрын
Thankyou Man. Have learn too much in a single video..
@spidey53242 жыл бұрын
I finally understand what is digger hilt after days of research...
@yahussainmazloom12 жыл бұрын
Thanks for making such clear and elaborative videos. Best
@lmaoiwaslikelmao11323 жыл бұрын
I've always thought CodingInFlow and CodingWithMitch's tutorials were good, but yours are better.
@mustafaammar5514 жыл бұрын
man i need this video so much Thank you very much BRO wish you all the best❤❤❤👍👍👍
@Zeeshan-Syed4 жыл бұрын
I actually love to see programming videos get 0 dislikes..
@PhilippLackner4 жыл бұрын
Agreed!
@feepin20584 жыл бұрын
Why have you said that ?!?! Now a troller did dislike -_-
@taslimoseni22314 жыл бұрын
@@feepin2058 Two trolls.
@ahmetburakilhan3983 жыл бұрын
@@taslimoseni2231 now four
@jahongirzokirov34533 жыл бұрын
@@ahmetburakilhan398 and now we actually cant see how much dislikes video got)
@yvanndeme37083 жыл бұрын
Thank a lot for this Tuto Phillip .
@farruhhabibullaev53163 жыл бұрын
Thanks for brief but complete intro to Hilt.
@phatho38753 жыл бұрын
Nice. What I need is an simple example of DI. And this is exactly what I’m looking for
@nevermore77553 жыл бұрын
For those having trouble with ViewModel log cat: @Module @InstallIn(ActivityRetainedComponent ::class) object MainModule { // This will only live in main activity // Cannot have @singleton that only lives as long as our activity // Instead of @Singleton, we use activity scoped @ActivityRetainedScoped @Provides @Named("String2") // if we need to access context, say strings file, how? // We used context as a parameter!! // dagger hilt will also figure out which testString1 we will inject!! fun provideTestString2(@ApplicationContext context: Context, @Named("String1") testString1: String) = "${context.getString(R.string.string_to_inject)} - $testString1" }
@dharamveergupta13052 жыл бұрын
@FightingCold Thanks, This was helpful for me, As I am using hilt dependency version 2.41.
@SahilGargjava3 жыл бұрын
Who the hell are these 5 people giving dislike to this kind of video. Great job man, keep up the good work
@PhilippLackner3 жыл бұрын
Thanks, will do!
@MunyiriTom3 жыл бұрын
Nice video. The demo and explanation makes it very easy to understand DI in android
@ghulammustafa70853 жыл бұрын
you are a good teacher i love your way of teaching please keep it up and upload more tutorials.
@PhilippLackner3 жыл бұрын
Thank you, I will
@buckyass4903 жыл бұрын
Wish I can like this tutorial more than one time! You saved my days, thank you!
@PhilippLackner3 жыл бұрын
Glad it helped!
@emmanuelpregnolato50263 жыл бұрын
Tx Phil, nicely done, the pace was perfect.
@mohamadrezazandieh3 жыл бұрын
the best tutorial forever :) thanks, Philipp
@PhilippLackner3 жыл бұрын
Glad you liked it!
@GriNAME3 жыл бұрын
Oh man, it exactly that I was looking for! Thank you so much!
@AtLinuxTerminal3 жыл бұрын
COOL ! Thanks for the explaination it's open my mind :) now heading back to Android Studio.
@nomugop80172 жыл бұрын
Perfect ! Your videos the best ones in all youtube bro! Have you got same videos about Koin ?
@bro_chenzox4 жыл бұрын
You use a parameter in ViewModel and scope of that parameter is ActivityScoped but has to be not less than ViewModelScoped. Component of InstallIn has to be the respective ViewModelComponent at least.
@developerkiwi83684 жыл бұрын
You have gained muscle 💪
@vipullal76893 жыл бұрын
Couldn't be better explained. Thanks!
@my_love_sanatan3 жыл бұрын
You should be awarded
@sanketbhangale57882 жыл бұрын
Thanks for such a wonderful explanation I appreciate your efforts
@yashkumar95014 жыл бұрын
Much needed........ Thank You sir 🙏🙏
@PhilippLackner4 жыл бұрын
Always welcome
@iJuce4 жыл бұрын
Hi Philipp, can you make a video about how to read the android developer documentation and learn to help outselves? Love your vids😁
@PhilippLackner4 жыл бұрын
Sounds stupid but by just reading it. There is no "right way"
@amitmondal74274 жыл бұрын
I really enjoyed the Dagger-Hilt 💕💕💕
@mrjackson9137 Жыл бұрын
One more point about Dagger Hilt is that you are not able to configure it for the library project as the entry point for it always has to be the Application which is absent in the library.
@hmasaya64092 жыл бұрын
すごく参考になりました。ありがとうございます!
@abdo-ar-8882 жыл бұрын
Thanks for your amazing tutorials ❤
@ajinkya_jagadale3 жыл бұрын
Thank you for explaining hilt in details !!!!
@mehulbisht97084 жыл бұрын
Hey, is providing Glide instance with hilt a good practice too? Because in your spotify clone app you provided an adapter instance as well along with glide instance. Kinda confusing, if I only wanted to pass an arraylist to my adapter but passing the glide instance in the constructor over the adapter now requires me to provide the adapter instance with hilt as well it seems. So what's the best practice , Philipp?
@PhilippLackner4 жыл бұрын
you should always make glide a singleton, and therefore provide it. You don't need a provide function for the adapter if you inject stuff in the constructor and hilt knows how to create that stuff
@codinginflow4 жыл бұрын
Glide is a singleton by default and it uses the fragment argument to handle cancellation of requests. You should actually not provide it from Dagger but instead call Glide.with() where you need it.
@PhilippLackner4 жыл бұрын
that's new to me
@codinginflow4 жыл бұрын
@@PhilippLackner Just follow the source code of Glide.with
@mehulbisht97084 жыл бұрын
thank you both of you, you guys are amazing!
@mrpi2302 жыл бұрын
Thank you great explanation 🙏
@Kunal-jp8tn3 жыл бұрын
Thank you so much for this amazing video.
@alexloera9038 Жыл бұрын
Excellent 👍
@h.r.604 жыл бұрын
Welcome back 😁
@PhilippLackner4 жыл бұрын
Thanks :D
@h.r.604 жыл бұрын
@@PhilippLackner You're a legend. Godspeed
@Arohap_me3 жыл бұрын
thank you, this was a short but useful tutorial
@daniyar27183 жыл бұрын
Thanks, nice constructive explanation👍
@DaniyalAk4 жыл бұрын
It's helpful and awesome teaching style 👍
@taslimoseni22314 жыл бұрын
Awesome explanation. Thank you.
@i_senne3 жыл бұрын
Great content. Thankssss Philipp
@Hrit2 жыл бұрын
I am getting this error Execution failed for task ':app:kaptDebugKotlin'. How do I fix it?
@ChrisAthanas4 жыл бұрын
Great explanation of a very difficult topic
@KarimSinouh4 жыл бұрын
Philipp looks like a gangsta in the thumbnail 😂❤️
@diargegaj7436 Жыл бұрын
What if im depended on a runtime thing ? E.g On my app I have a number picker. With 1 and 2. If user select 1 I want to Inject X thing, if user select 2 I want to inject Y thing. This X and Y are the same type. Type of Z. So in my viewModel (or whenever this will be used) I want only to `@Inject lateinit var test: Z`.
@ayoubdev4 жыл бұрын
Hey phillip can you put details video about supporting multiple screen in 2020 I see a lot of tutorial but none of works thanks for great videos
@amineayachi3352 жыл бұрын
how i can create a singleton viewmodel sheard between 2 screens
@anudeepananth3 жыл бұрын
Injecting a variable into a ViewModel with Hilt can be done easily with just a Companion Object right? Why do we need Hilt for that...
@fb7673 жыл бұрын
I didn't understand one thing: At 6:45 you stated that you can have it live for an Activity (by using ActivityComponent), but how do you tell it which Activity specifically?
@PhilippLackner3 жыл бұрын
Just the activity you inject it into
@hanifalfaqih3 жыл бұрын
Thank you, it help me to how implement dagger hilt in my project
@yarivzip2 жыл бұрын
Hey there. I get an error when trying to run the last thing you explained with the view model. When I replace the @InstallIn(ActivityComponent..) and @ActivityScoped annotations with @IntallIn(SingletoneComponent..) and @Singleton it works. I think it's because the MainModule which provides dependencies at an activity layer relies on the AppModule which provides dependencies at application level (because it's annotated as a singleton). Am I missing something?
@anudeepananth2 жыл бұрын
What if the variable string2 was created in the activity in a scenario like from IntentExtras and we need to pass it to the ViewModel without using a ViewModel factory
@nicolasfelipe13 жыл бұрын
the TestViewModel example does not work with lastest hill versions.
@techmarinar3 жыл бұрын
Hey man thank you for the great explaining,🤩👍
@bitwisedevs4692 жыл бұрын
It would be awesome to explain and show things about scoping, regardless this is a good video coming from plain Dagger 2
@gavinmurambadoro2 жыл бұрын
Watching your videos feels like cheating :). Every time I struggle with something I always watch one of your relevant videos, and voila. Thanks a million times and more man...
@PhilippLackner2 жыл бұрын
Thanks a lot and happy cheating :D
@albertbo21783 жыл бұрын
When I try to inject to the activity the viewmodel like this fails to compile for this reason: Classifier 'RoutesListViewModel' does not have a companion object, and thus must be initialized here Anyone knows how to solve this?
@vikashparajuli3 жыл бұрын
I am want to create an android library (without Application Class, Activity and Fragment) using Hilt. Can you please help on that?
@unistern3 жыл бұрын
nice vid. unfortunately hilt doesnt support DI in kotlin object . or do you know how to?
@renardsskutels4 жыл бұрын
Thank you very much for that!
@PhilippLackner4 жыл бұрын
You're welcome!
@c99rahul3 жыл бұрын
You should use the SingletonComponent, as ApplicationComponent doesn't exist in the new Dagger anymore.
@AlgeriaHere4 жыл бұрын
Helpful Videos but i have little suggestion , since we sometimes want to inject an a value like for example 2 strings , we can differenciate between using @Named("") , in one my project i did that also with qualifiers , now if both can do the same job what is the difference between them thank you ?
@yaboyjz3 жыл бұрын
very nice video man thank you
@tunahanbozkurt95163 жыл бұрын
You are the best !!!
@SohailAnsari-ek3oy2 жыл бұрын
ApplicationComponent is now replaced with SingletonComponent in the new version of hilt.
@salimmuhammed_um3 жыл бұрын
for new version use SingletonComponent::class rather than ApplicationComponent::class
@sanderlissenburg16083 жыл бұрын
Thank you, was looking for this.
@SKtheGEEK4 жыл бұрын
Hilt injection is not working with default args in the constructor. is this for me or anyone has faced this ??
@البرمجةللجميع-د4ظ4 жыл бұрын
Perfect as always
@divyanshverma24242 жыл бұрын
Is @Singleton is same as 'object' keyword in Kotlin?
@Monarch_9433 жыл бұрын
Is there a way to pass "myFragment" to the module? I used to do that in Dagger2 however I have no idea how to do it in Hilt
@fahrican97084 жыл бұрын
good explanation, thanks!
@bunyodbekmurodov18382 жыл бұрын
how can u buy video course "
@salamytech3 жыл бұрын
thanks a lot, but in hilt module ApplicationComponent replaced with SingletonComponent
@matt-g-recovers3 жыл бұрын
Your library is nearly complete. It's missing a playlist for Dagger Hilt showing examples of various objects being injected into various logical places.
@seba235712 жыл бұрын
for a strange reason I used hilt version 2.35 and it didn't work for me, then I used hilt version 2.40.5 and it worked, maybe someone has experienced the same thing
@raghavaggarwal86443 жыл бұрын
Hi Philipp thanks for the tutorial, after watching this beginner tutorial, which playlist of yours would u recommend if I want to start practically using Dependency Injection.
@starlite50973 жыл бұрын
Thanks for the video, I will go next to the Spotify clone I think.
@hojatghasemi8628 Жыл бұрын
This video needs to be updated because the gradle dependencies that are mentioned are not correct at this time and the dependency for "hilt-lifecycle-viewmodel" isn't needed in the newer versions of the library (if it's added to your project, there will be runtime errors).
@PhilippLackner Жыл бұрын
That's why I pinned a comment with another video 😅
@hojatghasemi8628 Жыл бұрын
@@PhilippLackner please remove this video; it's a bit confusing when there are 2 vids but only one of them is correct tutorial and you have to specifically read the comments to realize which one to follow 🤷🏾
@imnithish3 жыл бұрын
they have already removed ApplicationComponent😭 also viewmodel inject is deprecated
@akashdeepwadhwa58283 жыл бұрын
use @inject-corona-vaccine
@shreyashchoudhary74133 жыл бұрын
Epic!
@rickyfreddy69633 жыл бұрын
I love your tutorials, but this one should have started with "what is dagger-hilt". I never heard of it and the title made me think you were going to teach me :p
@georgenady73753 жыл бұрын
perfect 👌
@remmievail81482 жыл бұрын
Any chance you can update this? Your tutorials are great, but there have been a number of changes and Google is horrible when it comes to teaching anything
@anggoro81783 жыл бұрын
hey man, as always thanks for the great video, but i want to ask why don't u use koin for dependency injection? it is much much more simpler to use in my opinion
@erfansn8694 жыл бұрын
very good
@brucebane74014 жыл бұрын
Awesome!!!
@PhilippLackner4 жыл бұрын
Thanks!!
@DARKcarlos14 жыл бұрын
love this video. I have a question, what if I'm working with MVP (with Repository Pattern) and want to inject a room db instance and a retrofit instance? Do I need to inject roomdb and retrofit instances in the View, and send them as parameters to the presenter, and from presenter to the repository? thanks philipp for this tutorials, finally applying DI in my projects by watching your videos
@DjangoMx4 жыл бұрын
ok, si lo haces como dices estarias rompiendo el patron MVP ya que el framework en este caso android no debe llegar al Presenter, lo que tienes que hacer ahi es hacer una abstraccion de esas dependicias a una interface y usar estas en tu repository una vez que lo hagas al crear el provide del repo creas otra clase que implemente cada una de las interfaces antes mencionada es decir una que implemente la del localDataSource(Room) y otra que implemente el remoteDataSource(Retorfit) en cada una de ellas puedes pasar el context o cualquier otra dependencia que necesites y sera esta implementacion la que le pases al repository. Si necesitas ayuda escribeme por discord: DjangoMx
@DARKcarlos14 жыл бұрын
@@DjangoMx suuper! trataré de hacer lo que me indicas, y si sigo perdido, te pido ayuda si es posible vale? Te agradezco mucho tu respuesta
@mrdeveloper44384 жыл бұрын
hi...can you tell me about kiosk application in android....this is more interesting...