Hilt Dependency Injection (Kotlin Beginner Example)

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ธ.ค. 2020
  • The BEST android courses in the world: codingwithmitch.com/
    In this video I show you how to use Hilt for dependency injection on android. This is a Kotlin example for beginners. Some of the other dependency injection libraries are Koin, Kodein, and Dagger. Hilt is the simplest way to do dependency injection on android (in my opinion). Hilt is built on top of dagger and makes dagger much simpler.
    Code: github.com/mitchtabian/MVVMRe...
    Follow me:
    Instagram: / codingwithmitch
    Twitter: / mitch_tabian
    .
    .
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 101

  • @NMNaufaldo
    @NMNaufaldo 3 ปีที่แล้ว +72

    12:02 In the new version of Hilt, `ApplicationComponent` just change to `SingletonComponent`

  • @codinginflow
    @codinginflow 3 ปีที่แล้ว +20

    Here is your engagement

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว +3

      nice 1

    • @codinginflow
      @codinginflow 3 ปีที่แล้ว +11

      @@codingwithmitch What I don't even get a heart?

    • @felipefranco7444
      @felipefranco7444 3 ปีที่แล้ว +3

      @@codinginflow lol coding in flow you are also an awesome mentor!

    • @codinginflow
      @codinginflow 3 ปีที่แล้ว +2

      @@felipefranco7444 What do you mean "also"?

    • @felipefranco7444
      @felipefranco7444 3 ปีที่แล้ว +2

      @@codinginflow Mitch is a mentor so are you . Both teach developers in a great way!

  • @samyups1111
    @samyups1111 3 ปีที่แล้ว +3

    I started learning Kotlin/Android in December and you are one of my constant go-to person! Also, THANK YOU for switching to Kotlin!!!

  • @asmg4m3r65
    @asmg4m3r65 2 ปีที่แล้ว

    First time on the channel and I already loved your content! Keep it up, brother!

  • @richardgarcia6677
    @richardgarcia6677 3 ปีที่แล้ว

    Holy mother, i just ended up learning dagger and started with hilt so hilt make things a lot easier an much more clean. the negative point is tha it is in alpha release and a lot of deprecations happens making the maintenance a little much effort in this beggining but it definitely will be a strong requisite in the near future i will definitely use it... Thanks for the course you definitely nail it

  • @kostyabakay
    @kostyabakay 3 ปีที่แล้ว +2

    Best DI tutorial! I have tried to learn Dagger several times but always I was giving up because of the complexity of the library...

  • @lifeOfCharlesMaina
    @lifeOfCharlesMaina 3 ปีที่แล้ว

    My best teacher any time when it comes to Android things 💯

  • @talhashaikh1435
    @talhashaikh1435 2 ปีที่แล้ว

    Nicely Explained in short..Sometimes few words can do magic ..this particular tutorial does the same

  • @jonathanaustin4328
    @jonathanaustin4328 11 หลายเดือนก่อน

    Thanks for the vid, already easier to understand. Looking for the next one already.

  • @lirjarmuhametova8516
    @lirjarmuhametova8516 ปีที่แล้ว

    Я плохо знаю английский язык, но вы так хорошо объясняете, что даже я всё поняла. Спасибо большое за урок. Пожалуйста, продолжайте снимать видео

  • @DS-bz4mz
    @DS-bz4mz ปีที่แล้ว

    Very concise and helpful explanation, thank you :)

  • @tonnie7079
    @tonnie7079 2 ปีที่แล้ว

    Great Content and demonstration, easy to follow

  • @hellespont5072
    @hellespont5072 3 ปีที่แล้ว

    The gift that keeps on giving! 😁

  • @tanjimahmed213
    @tanjimahmed213 2 ปีที่แล้ว

    Thank you, Mitch! Here is your engagement and your like! Keep it up! 👍

  • @SmemsMusic
    @SmemsMusic 3 ปีที่แล้ว

    Really good explanation man, thank you.

  • @inmikeshands1722
    @inmikeshands1722 3 ปีที่แล้ว +2

    I am a codingWithMitch founding member subscriber and honestly its one of the best if not the best subscription I ever made in my life highly recommend,
    this is my first time seeing hilt at work and yes it is much easier and more straightforward to understand and to use then dagger2 so thank you Mitch for everything you are doing for us please keep it up

  • @shafaquesattar
    @shafaquesattar 3 ปีที่แล้ว +1

    You are doing a great job..

  • @genshinassassin1139
    @genshinassassin1139 3 ปีที่แล้ว +1

    Watching this video 69th time
    Still hilt is something to learn🧐
    And will learn it soon

  • @staceyrichards8656
    @staceyrichards8656 3 ปีที่แล้ว

    Thanks Mitch. Very clear and concise explanation. It helped me a lot.

  • @ecemvarma4546
    @ecemvarma4546 2 ปีที่แล้ว

    Thanks for the vid best explanation!

  • @alexiachimov9817
    @alexiachimov9817 3 ปีที่แล้ว

    Awesome tutorials !

  • @ivanbartolelli9361
    @ivanbartolelli9361 3 ปีที่แล้ว

    Hey Mitch, if you someday come to Argentina I will be glad to buy you a good Fernet with Coca, you deserve it dude!

  • @hotellinaweb
    @hotellinaweb 3 หลายเดือนก่อน

    Hey Mitch I liked the video 😁😁
    I hope I will be able to understand why are we doing DI by next two videos.

  • @PhilandNevie
    @PhilandNevie 3 ปีที่แล้ว

    Great summary.

  • @__Minecraft_Poseidon__
    @__Minecraft_Poseidon__ 3 ปีที่แล้ว +1

    Thank you!

  • @abdulrasheedilori7680
    @abdulrasheedilori7680 2 ปีที่แล้ว

    nice one mitch

  • @abdelrhmantalat9813
    @abdelrhmantalat9813 3 ปีที่แล้ว +1

    Greate Work!!

  • @judefrancis
    @judefrancis 3 ปีที่แล้ว +1

    Awesome stuff

  • @hanamanth_vlogs6565
    @hanamanth_vlogs6565 3 ปีที่แล้ว +1

    Very good content sir

  • @danyelsh874
    @danyelsh874 2 ปีที่แล้ว

    thanks, dear mitch

  • @muhammedshahin6299
    @muhammedshahin6299 ปีที่แล้ว

    Awesome one

  • @MedAmineSouaiaia88
    @MedAmineSouaiaia88 3 ปีที่แล้ว +1

    Thank you; you made DI clear for me.

  • @mal7othify
    @mal7othify 3 ปีที่แล้ว

    Great engagement

  • @muzammalabdulghafoor6418
    @muzammalabdulghafoor6418 3 ปีที่แล้ว +6

    Man! You look better with bear, MaShaAllah!

    • @abolfazlrezaei5397
      @abolfazlrezaei5397 3 ปีที่แล้ว

      for who don't know about MaShaAllah, MashaAllah is a word that Muslims says to another guy :), so that means are you so good man 😂

    • @johnxina6996
      @johnxina6996 2 ปีที่แล้ว

      lol, no

  • @maXXik1337
    @maXXik1337 3 ปีที่แล้ว +1

    Hello sir, great video as always.
    Right now, i feel exactly like you described at the end. Which is something i feel incredibly often as being complete programming (Kotlin) newbie.... why do we do this instead of just put val string: String into viewModel constructor, right? I often feel things are way more complicated then they should/could be :|
    But if you anticipate it, i feel just fine about that, looking forward to next videos.
    One suggestion: you say that we should use this mostly for testing purposes, so last video if this course (or maybe even whole new series?) should touch testing for beginners and especially how using Hilt simplifies doing so.

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว +1

      Next course with the cache will include some unit tests

  • @vanosuperhero
    @vanosuperhero 2 ปีที่แล้ว

    Thanks!

  • @roshanfx369
    @roshanfx369 3 ปีที่แล้ว +1

    Thanks

  • @taar1
    @taar1 3 ปีที่แล้ว

    In Android Studio there's a presentation mode: View -> Appearance -> Enter Presentation Mode
    Could help for future videos :)

  • @Hacker-x
    @Hacker-x 3 ปีที่แล้ว +2

    This time.. I am watching the video in the car and waiting the order from restaurant.. Thanks😎

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว +1

      Way to be efficient

    • @Hacker-x
      @Hacker-x 3 ปีที่แล้ว +1

      Thank you Mitch. I like your channel.. I am following you from Oman

  • @MaisUmSomente
    @MaisUmSomente 3 ปีที่แล้ว

    I will try that.

  • @siddharthashankar8396
    @siddharthashankar8396 2 ปีที่แล้ว

    Nice Video

  • @silviavargas931
    @silviavargas931 2 ปีที่แล้ว

    Wow I like

  • @faithphysicsphilosophy6721
    @faithphysicsphilosophy6721 3 ปีที่แล้ว

    Thank you

  • @danyelsh874
    @danyelsh874 2 ปีที่แล้ว

    perfect

  • @mytubekt
    @mytubekt 3 ปีที่แล้ว +1

    Great explanation ! :)

  • @JitubhaiyaPhysics
    @JitubhaiyaPhysics 3 ปีที่แล้ว +2

    mitch

  • @TanujSareenRockStarDeveloper
    @TanujSareenRockStarDeveloper 3 ปีที่แล้ว +1

    👍

  • @AkshatKumawat
    @AkshatKumawat 3 ปีที่แล้ว +1

    ✌️✌️

  • @ahmetbozkan4610
    @ahmetbozkan4610 3 ปีที่แล้ว +1

    cool

  • @MuhammadNaveed2016
    @MuhammadNaveed2016 3 ปีที่แล้ว +2

    First Engagement

  • @electricalprogrammer456
    @electricalprogrammer456 2 ปีที่แล้ว

    🐐🐐🐐🐐

  • @mehdiparsaei1867
    @mehdiparsaei1867 3 ปีที่แล้ว +2

    The second. Thanks a lot.

  • @juniorlapunete4660
    @juniorlapunete4660 3 ปีที่แล้ว

    Hi Mitch, please can make more videos about CRUD MVI using kotlin?

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว

      I have tons. Look at any of my courses on my website

  • @chaitanyagopinadh6000
    @chaitanyagopinadh6000 3 ปีที่แล้ว

    Hi,
    Everything undterstood well but one doubt how the module methods will call in mainactivity without we call those,Example you showed one randomstring append in mainactivity and printed in log,
    Could you please clarify me...

  • @ankurg_
    @ankurg_ 3 ปีที่แล้ว +3

    What if I have two functions of return type String. How Hilt will figure out which dependency to provide?

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว

      Tomorrows video will show you that (part 15)

    • @ankurg_
      @ankurg_ 3 ปีที่แล้ว +1

      @@codingwithmitch Thanks Mitch. Just saw that video and my doubt is clear :)

  • @johnybaby9574
    @johnybaby9574 3 ปีที่แล้ว

    i am liking this video lol

  • @HelloBayzid
    @HelloBayzid 3 ปีที่แล้ว +2

    First view

  • @kaiumhossain3208
    @kaiumhossain3208 2 ปีที่แล้ว

    hey Mitch hilt is not working for new gradle versions 7 and up. It's showing missing dependency but have applied all the dependencies needed

  • @tausifuddinahmed4868
    @tausifuddinahmed4868 3 ปีที่แล้ว

    is DI only used for making testing easier? Code reusability is another vital reason according to the android official documentation.

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว +1

      Yes I said that. You use the same instance of an object

  • @abhimanyoosingh7027
    @abhimanyoosingh7027 3 ปีที่แล้ว

    If possible please suggest how to work admob 💵💵💵 with hilt and viewmodel

  • @Soaring333
    @Soaring333 2 ปีที่แล้ว

    I can't get any of the dependency stuff to build. Not sure what I'm missing.

  • @muhammadrizwan7179
    @muhammadrizwan7179 3 ปีที่แล้ว +1

    Nice, confusion is going away

  • @terencejumba1939
    @terencejumba1939 2 ปีที่แล้ว

    if you are getting errors after adding hilt when you run build the app:KaptDebugKotlin error remove the @parcelize annotation in recipe model class

  • @user-jg4pk6bq2g
    @user-jg4pk6bq2g 3 ปีที่แล้ว +1

    Mitch, you have site codingwithmitch.com. Did you create it by youself, with you own hands?

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว +1

      Yep with my own hands ✋

    • @user-jg4pk6bq2g
      @user-jg4pk6bq2g 3 ปีที่แล้ว

      @@codingwithmitch Good job! How could you learn so many things?! I admire)

    • @codingwithmitch
      @codingwithmitch  3 ปีที่แล้ว

      @@user-jg4pk6bq2g lots of time lol

  • @alaadeego5416
    @alaadeego5416 3 ปีที่แล้ว

    hey mitch ur engagement

  • @erickramones2167
    @erickramones2167 3 ปีที่แล้ว

    7:52 fontsize was ok, maybe 35.

  • @igorkluev5682
    @igorkluev5682 3 ปีที่แล้ว

    comment for the algorithem gods

  • @samstoyroom
    @samstoyroom 2 ปีที่แล้ว

    What about Koin?

  • @bboydarknesz
    @bboydarknesz 3 ปีที่แล้ว +1

    ok, report
    now ApplicationConmponent is deprecated and replaced with SingletonComponent
    :'D

  • @weirdyadav
    @weirdyadav 3 ปีที่แล้ว

    Was your beard always that thick?

  • @yuruar
    @yuruar 3 ปีที่แล้ว

    Nothing is clear

  • @cristicode4301
    @cristicode4301 6 หลายเดือนก่อน

    Very shallow bullshit explanation. No one understood anything. Reminds me of Traversy type of explanation.

  • @tom-wz5le
    @tom-wz5le 2 ปีที่แล้ว

    Thanks

  • @udayshah4525
    @udayshah4525 3 ปีที่แล้ว +1

    Here is your engagement

  • @mohammadshahhoud5120
    @mohammadshahhoud5120 3 ปีที่แล้ว

    Thanks

  • @anantawasthy4892
    @anantawasthy4892 3 ปีที่แล้ว

    Here is your engagement