Join Chiu-Ki Chan for an in-depth discussion in this video Dagger dependencies, part of Advanced Android Espresso Testing.
- [Instructor] To use dagger, the first thing we need…is to include its dependency.…Open app slash build dot gradle.…Inside of the dependency block, on line 29,…add implementation...…And then com.google.dagger:dagger:2.14.1.…
Next, add kapt and then copy from the previous line…and change dagger to dagger-compiler.…We need to add one more line.…Provided and then javax.annotation:jsr250-api:1.0.…
What are these lines?…On line 29, we ask for the dagger dependency.…Dagger uses annotation to generate code automatically.…For that generation, we need the dagger compiler.…That is what we are asking for in line 30 with kapt.…On line 31, we are providing the javax annotation…so that dagger knows how to deal with the annotations.…
All these dependencies go to the app.…Because we are using dagger during test,…we will also need the dagger compiler for Android test.…Copy your line 30 and paste it in line 35.…Instead of kapt, change it to kaptAndroidTest.…Now we have all of the dependencies we need for dagger.…
Let's perform a gradle sync.…
- Incoming and outgoing intents
- How intents are used
- Dependency injection
- Why extract dependencies?
- Mockito and Dagger
Skill Level Advanced
Effective Android Testing for Mobile Developerswith Chiu-Ki Chan2h 56m Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis4h 52m Intermediate
2. Hermetic Test Environment
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.