Dagger- Should we create each component and module for each Activity/ Fragment

Declaring a separate module for each Activity is not a good idea at all. Declaring separate component for each Activity is even worse. The reasoning behind this is very simple – you don’t really need all these module/components (as you have already seen by yourself). However, having just one component that is tied to Application‘s … Read more

How to set up DAGGER dependency injection from scratch in Android project?

Guide for Dagger 2.x (Revised Edition 6): The steps are the following: 1.) add Dagger to your build.gradle files: top level build.gradle: . // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath ‘com.android.tools.build:gradle:2.2.0’ classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’ //added apt for source code generation … Read more

“Prefer to run the dagger processor over that class instead” in Kotlin

I am afraid you can’t. Why not write dependency modules in Kotlin? To write dependency modules in java, you need to configure your Gradle script in this way: compile ‘com.google.dagger:dagger:2.8’ apt ‘com.google.dagger:dagger-compiler:2.8’ But, to write dependency modules in Kotlin, you should configure your Gradle script in this way: compile ‘com.google.dagger:dagger:2.8’ kapt ‘com.google.dagger:dagger-compiler:2.8’ dagger need the … Read more

Dagger 2 subcomponents vs component dependencies

Component dependencies – Use this when you want to keep two components independent. Subcomponents – Use this when you want to keep two components coupled. I will use the below example to explain Component dependencies and Subcomponents. Some points worth noticing about the example are: SomeClassA1 can be created without any dependency. ModuleA provides and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)