Dagger-Hilt in Detail - Full Course

  Рет қаралды 82,907

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер
@PhilippLackner
@PhilippLackner 2 жыл бұрын
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
@fb767
@fb767 3 жыл бұрын
Also, note that ApplicationComponent has been replaced with SingletonComponent. ApplicationComponent will now cause a unresolved reference error.
@vamsireddy7560
@vamsireddy7560 3 жыл бұрын
Yes ! ApplicationComponent is Deprecated in new Version of Dagger then we have Instead use SIngletonComponent
@osmanmusse9432
@osmanmusse9432 2 жыл бұрын
thanks
@yarivzip
@yarivzip 2 жыл бұрын
@@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?
@pqsk
@pqsk 2 жыл бұрын
@@yarivzip I believe that's ActivityComponent
@durbie90
@durbie90 3 жыл бұрын
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.
@livlop
@livlop 4 жыл бұрын
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 🤜🤛
@aravindhsamidurai5300
@aravindhsamidurai5300 3 жыл бұрын
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.
@mikemikee7797
@mikemikee7797 4 жыл бұрын
Android file system could be also a good candidate for "in detail" video ^^
@bjugdbjk
@bjugdbjk 3 жыл бұрын
This video clarified my many questions on Hilt and you have such a great skill of explaining complex things pretty simple way. Thanks again.
@Mikerandria
@Mikerandria 2 жыл бұрын
I wish every tutorial on KZbin would be on this level! Too clean.
@Another0neTime
@Another0neTime 4 жыл бұрын
I was just reading a cheat sheet to get familiar with the annotations, then you upload this awesome video. Thanks!!!
@aayushsarikhada6
@aayushsarikhada6 2 жыл бұрын
Can you please provide me that cheat sheet please 👍
@sustainabilitybeauty3318
@sustainabilitybeauty3318 Жыл бұрын
Thank you philip, the annotation @Named one helps me to deal with the problem with multiple BASE URL, Thankkk uuuu
@mkc0321
@mkc0321 3 жыл бұрын
why people dislike such amazing videos ? i think its youtube algorithim which does it automatically
@jeckonly5853
@jeckonly5853 2 жыл бұрын
i come back again!! thanks phillipp 😀Actually , you give me a lot help in Android dev!!
@abbasadrali
@abbasadrali 3 жыл бұрын
Thankyou Man. Have learn too much in a single video..
@spidey5324
@spidey5324 2 жыл бұрын
I finally understand what is digger hilt after days of research...
@yahussainmazloom1
@yahussainmazloom1 2 жыл бұрын
Thanks for making such clear and elaborative videos. Best
@lmaoiwaslikelmao1132
@lmaoiwaslikelmao1132 3 жыл бұрын
I've always thought CodingInFlow and CodingWithMitch's tutorials were good, but yours are better.
@mustafaammar551
@mustafaammar551 4 жыл бұрын
man i need this video so much Thank you very much BRO wish you all the best❤❤❤👍👍👍
@Zeeshan-Syed
@Zeeshan-Syed 4 жыл бұрын
I actually love to see programming videos get 0 dislikes..
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Agreed!
@feepin2058
@feepin2058 4 жыл бұрын
Why have you said that ?!?! Now a troller did dislike -_-
@taslimoseni2231
@taslimoseni2231 4 жыл бұрын
@@feepin2058 Two trolls.
@ahmetburakilhan398
@ahmetburakilhan398 3 жыл бұрын
@@taslimoseni2231 now four
@jahongirzokirov3453
@jahongirzokirov3453 3 жыл бұрын
@@ahmetburakilhan398 and now we actually cant see how much dislikes video got)
@yvanndeme3708
@yvanndeme3708 3 жыл бұрын
Thank a lot for this Tuto Phillip .
@farruhhabibullaev5316
@farruhhabibullaev5316 3 жыл бұрын
Thanks for brief but complete intro to Hilt.
@phatho3875
@phatho3875 3 жыл бұрын
Nice. What I need is an simple example of DI. And this is exactly what I’m looking for
@nevermore7755
@nevermore7755 3 жыл бұрын
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" }
@dharamveergupta1305
@dharamveergupta1305 2 жыл бұрын
@FightingCold Thanks, This was helpful for me, As I am using hilt dependency version 2.41.
@SahilGargjava
@SahilGargjava 3 жыл бұрын
Who the hell are these 5 people giving dislike to this kind of video. Great job man, keep up the good work
@PhilippLackner
@PhilippLackner 3 жыл бұрын
Thanks, will do!
@MunyiriTom
@MunyiriTom 3 жыл бұрын
Nice video. The demo and explanation makes it very easy to understand DI in android
@ghulammustafa7085
@ghulammustafa7085 3 жыл бұрын
you are a good teacher i love your way of teaching please keep it up and upload more tutorials.
@PhilippLackner
@PhilippLackner 3 жыл бұрын
Thank you, I will
@buckyass490
@buckyass490 3 жыл бұрын
Wish I can like this tutorial more than one time! You saved my days, thank you!
@PhilippLackner
@PhilippLackner 3 жыл бұрын
Glad it helped!
@emmanuelpregnolato5026
@emmanuelpregnolato5026 3 жыл бұрын
Tx Phil, nicely done, the pace was perfect.
@mohamadrezazandieh
@mohamadrezazandieh 3 жыл бұрын
the best tutorial forever :) thanks, Philipp
@PhilippLackner
@PhilippLackner 3 жыл бұрын
Glad you liked it!
@GriNAME
@GriNAME 3 жыл бұрын
Oh man, it exactly that I was looking for! Thank you so much!
@AtLinuxTerminal
@AtLinuxTerminal 3 жыл бұрын
COOL ! Thanks for the explaination it's open my mind :) now heading back to Android Studio.
@nomugop8017
@nomugop8017 2 жыл бұрын
Perfect ! Your videos the best ones in all youtube bro! Have you got same videos about Koin ?
@bro_chenzox
@bro_chenzox 4 жыл бұрын
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.
@developerkiwi8368
@developerkiwi8368 4 жыл бұрын
You have gained muscle 💪
@vipullal7689
@vipullal7689 3 жыл бұрын
Couldn't be better explained. Thanks!
@my_love_sanatan
@my_love_sanatan 3 жыл бұрын
You should be awarded
@sanketbhangale5788
@sanketbhangale5788 2 жыл бұрын
Thanks for such a wonderful explanation I appreciate your efforts
@yashkumar9501
@yashkumar9501 4 жыл бұрын
Much needed........ Thank You sir 🙏🙏
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Always welcome
@iJuce
@iJuce 4 жыл бұрын
Hi Philipp, can you make a video about how to read the android developer documentation and learn to help outselves? Love your vids😁
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Sounds stupid but by just reading it. There is no "right way"
@amitmondal7427
@amitmondal7427 4 жыл бұрын
I really enjoyed the Dagger-Hilt 💕💕💕
@mrjackson9137
@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.
@hmasaya6409
@hmasaya6409 2 жыл бұрын
すごく参考になりました。ありがとうございます!
@abdo-ar-888
@abdo-ar-888 2 жыл бұрын
Thanks for your amazing tutorials ❤
@ajinkya_jagadale
@ajinkya_jagadale 3 жыл бұрын
Thank you for explaining hilt in details !!!!
@mehulbisht9708
@mehulbisht9708 4 жыл бұрын
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?
@PhilippLackner
@PhilippLackner 4 жыл бұрын
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
@codinginflow
@codinginflow 4 жыл бұрын
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.
@PhilippLackner
@PhilippLackner 4 жыл бұрын
that's new to me
@codinginflow
@codinginflow 4 жыл бұрын
@@PhilippLackner Just follow the source code of Glide.with
@mehulbisht9708
@mehulbisht9708 4 жыл бұрын
thank you both of you, you guys are amazing!
@mrpi230
@mrpi230 2 жыл бұрын
Thank you great explanation 🙏
@Kunal-jp8tn
@Kunal-jp8tn 3 жыл бұрын
Thank you so much for this amazing video.
@alexloera9038
@alexloera9038 Жыл бұрын
Excellent 👍
@h.r.60
@h.r.60 4 жыл бұрын
Welcome back 😁
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Thanks :D
@h.r.60
@h.r.60 4 жыл бұрын
@@PhilippLackner You're a legend. Godspeed
@Arohap_me
@Arohap_me 3 жыл бұрын
thank you, this was a short but useful tutorial
@daniyar2718
@daniyar2718 3 жыл бұрын
Thanks, nice constructive explanation👍
@DaniyalAk
@DaniyalAk 4 жыл бұрын
It's helpful and awesome teaching style 👍
@taslimoseni2231
@taslimoseni2231 4 жыл бұрын
Awesome explanation. Thank you.
@i_senne
@i_senne 3 жыл бұрын
Great content. Thankssss Philipp
@Hrit
@Hrit 2 жыл бұрын
I am getting this error Execution failed for task ':app:kaptDebugKotlin'. How do I fix it?
@ChrisAthanas
@ChrisAthanas 4 жыл бұрын
Great explanation of a very difficult topic
@KarimSinouh
@KarimSinouh 4 жыл бұрын
Philipp looks like a gangsta in the thumbnail 😂❤️
@diargegaj7436
@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`.
@ayoubdev
@ayoubdev 4 жыл бұрын
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
@amineayachi335
@amineayachi335 2 жыл бұрын
how i can create a singleton viewmodel sheard between 2 screens
@anudeepananth
@anudeepananth 3 жыл бұрын
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...
@fb767
@fb767 3 жыл бұрын
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?
@PhilippLackner
@PhilippLackner 3 жыл бұрын
Just the activity you inject it into
@hanifalfaqih
@hanifalfaqih 3 жыл бұрын
Thank you, it help me to how implement dagger hilt in my project
@yarivzip
@yarivzip 2 жыл бұрын
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?
@anudeepananth
@anudeepananth 2 жыл бұрын
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
@nicolasfelipe1
@nicolasfelipe1 3 жыл бұрын
the TestViewModel example does not work with lastest hill versions.
@techmarinar
@techmarinar 3 жыл бұрын
Hey man thank you for the great explaining,🤩👍
@bitwisedevs469
@bitwisedevs469 2 жыл бұрын
It would be awesome to explain and show things about scoping, regardless this is a good video coming from plain Dagger 2
@gavinmurambadoro
@gavinmurambadoro 2 жыл бұрын
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...
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Thanks a lot and happy cheating :D
@albertbo2178
@albertbo2178 3 жыл бұрын
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?
@vikashparajuli
@vikashparajuli 3 жыл бұрын
I am want to create an android library (without Application Class, Activity and Fragment) using Hilt. Can you please help on that?
@unistern
@unistern 3 жыл бұрын
nice vid. unfortunately hilt doesnt support DI in kotlin object . or do you know how to?
@renardsskutels
@renardsskutels 4 жыл бұрын
Thank you very much for that!
@PhilippLackner
@PhilippLackner 4 жыл бұрын
You're welcome!
@c99rahul
@c99rahul 3 жыл бұрын
You should use the SingletonComponent, as ApplicationComponent doesn't exist in the new Dagger anymore.
@AlgeriaHere
@AlgeriaHere 4 жыл бұрын
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 ?
@yaboyjz
@yaboyjz 3 жыл бұрын
very nice video man thank you
@tunahanbozkurt9516
@tunahanbozkurt9516 3 жыл бұрын
You are the best !!!
@SohailAnsari-ek3oy
@SohailAnsari-ek3oy 2 жыл бұрын
ApplicationComponent is now replaced with SingletonComponent in the new version of hilt.
@salimmuhammed_um
@salimmuhammed_um 3 жыл бұрын
for new version use SingletonComponent::class rather than ApplicationComponent::class
@sanderlissenburg1608
@sanderlissenburg1608 3 жыл бұрын
Thank you, was looking for this.
@SKtheGEEK
@SKtheGEEK 4 жыл бұрын
Hilt injection is not working with default args in the constructor. is this for me or anyone has faced this ??
@البرمجةللجميع-د4ظ
@البرمجةللجميع-د4ظ 4 жыл бұрын
Perfect as always
@divyanshverma2424
@divyanshverma2424 2 жыл бұрын
Is @Singleton is same as 'object' keyword in Kotlin?
@Monarch_943
@Monarch_943 3 жыл бұрын
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
@fahrican9708
@fahrican9708 4 жыл бұрын
good explanation, thanks!
@bunyodbekmurodov1838
@bunyodbekmurodov1838 2 жыл бұрын
how can u buy video course "
@salamytech
@salamytech 3 жыл бұрын
thanks a lot, but in hilt module ApplicationComponent replaced with SingletonComponent
@matt-g-recovers
@matt-g-recovers 3 жыл бұрын
Your library is nearly complete. It's missing a playlist for Dagger Hilt showing examples of various objects being injected into various logical places.
@seba23571
@seba23571 2 жыл бұрын
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
@raghavaggarwal8644
@raghavaggarwal8644 3 жыл бұрын
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.
@starlite5097
@starlite5097 3 жыл бұрын
Thanks for the video, I will go next to the Spotify clone I think.
@hojatghasemi8628
@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
@PhilippLackner Жыл бұрын
That's why I pinned a comment with another video 😅
@hojatghasemi8628
@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 🤷🏾
@imnithish
@imnithish 3 жыл бұрын
they have already removed ApplicationComponent😭 also viewmodel inject is deprecated
@akashdeepwadhwa5828
@akashdeepwadhwa5828 3 жыл бұрын
use @inject-corona-vaccine
@shreyashchoudhary7413
@shreyashchoudhary7413 3 жыл бұрын
Epic!
@rickyfreddy6963
@rickyfreddy6963 3 жыл бұрын
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
@georgenady7375
@georgenady7375 3 жыл бұрын
perfect 👌
@remmievail8148
@remmievail8148 2 жыл бұрын
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
@anggoro8178
@anggoro8178 3 жыл бұрын
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
@erfansn869
@erfansn869 4 жыл бұрын
very good
@brucebane7401
@brucebane7401 4 жыл бұрын
Awesome!!!
@PhilippLackner
@PhilippLackner 4 жыл бұрын
Thanks!!
@DARKcarlos1
@DARKcarlos1 4 жыл бұрын
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
@DjangoMx
@DjangoMx 4 жыл бұрын
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
@DARKcarlos1
@DARKcarlos1 4 жыл бұрын
@@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
@mrdeveloper4438
@mrdeveloper4438 4 жыл бұрын
hi...can you tell me about kiosk application in android....this is more interesting...
Make Your Code Clean With the SOLID Principles
18:24
Philipp Lackner
Рет қаралды 102 М.
OCCUPIED #shortssprintbrasil
0:37
Natan por Aí
Рет қаралды 131 МЛН
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН
Sigma girl VS Sigma Error girl 2  #shorts #sigma
0:27
Jin and Hattie
Рет қаралды 124 МЛН
7 Design Patterns EVERY Developer Should Know
23:09
ForrestKnight
Рет қаралды 187 М.
Advanced Kotlin: Mastering Delegation in Kotlin
18:54
kt whisperer
Рет қаралды 9 М.
The Full Guide to ANNOTATIONS In Kotlin
21:32
Philipp Lackner
Рет қаралды 32 М.
Building a Mobile App in 2025: The BEST Technologies
13:31
Dan Ilies
Рет қаралды 125 М.
Full Guide to Manual Dependency Injection + Removing Dagger
14:50
Philipp Lackner
Рет қаралды 41 М.
Dagger Hilt - Assisted Inject Hilt in Android!
9:31
Charfaoui Younes
Рет қаралды 1,6 М.
Все про Dagger Hilt в Android Studio + Kotlin
52:11
Neco Ru
Рет қаралды 13 М.
Learn Dependency Injection and Write Better Code
21:52
Amigoscode
Рет қаралды 178 М.
OCCUPIED #shortssprintbrasil
0:37
Natan por Aí
Рет қаралды 131 МЛН