The UI module allows us to implement the user interface of our application for a specific form factor or framework. In this lesson, we're going to be setting up the dependency injection for the module to allow us to inject various components to the different modules of our application.
I couldn't understand this lesson completely. I understand the general idea of the ApplicationComponent but couldn't understand the way @Component.Buider and @BindsInstance work, the why and how!. Wouldn't be easier to just provide the application?
Looks like he's doing the same thing as providing the application, just with a smaller amount of code. The application instance that's passed in gets bound to the component with the @BindsInstance and is injectable.
I'm confused, where does DaggerApplicationComponent come from? I see the import that points to
import co.joebirch.mobile_ui.injection.DaggerApplicationComponent which doesn't exist in the source folder, and apparently does in the build folder.
I ran into a stupidly annoying error when I try to build the project after this lesson:
The UiThread class keeps showing:
Unresolved reference: domain
Unresolved reference: PostExecutionThread
'scheduler' overrides nothing
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':mobile-ui:compileDebugKotlin'.
Compilation error. See log for more details
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mobile-ui:compileDebugKotlin'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141) (...)
I had to include implementation project(':Domain') to the mobile-ui build.gradle. Does that break the separation of concerns? Or this wasn't included in the code by mistake?