I am struggling with installing Dagger (1.0.1) in an existing application. It was configured to use ProGuard, but I disabled it for this test using -dontobfuscate .
When I turn on the king compiler, it can successfully generate a dot file with a dependency graph, but when I remove the compiler and create the application in Release mode, it crashes at startup, complaining that it cannot create an object graph.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.corp.myapp/com.corp.myapp.ui.activity.MainActivity}: java.lang.IllegalStateException: Errors creating object graph: No injectable members on com.corp.myapp.core.services.ConnectionMonitor. Do you want to add an injectable constructor? required by com.corp.myapp.core.services.ConnectionMonitor com.corp.myapp.ui.activity.MyAppBaseActivity.connectionManager No injectable members on com.corp.myapp.ui.crouton.CroutonManager. Do you want to add an injectable constructor? required by com.corp.myapp.ui.crouton.CroutonManager com.corp.myapp.ui.activity.MyAppBaseActivity.croutonManager No injectable members on com.corp.core.assembler.ResourceAssembler. Do you want to add an injectable constructor? required by com.corp.core.assembler.ResourceAssembler com.corp.myapp.ui.activity.MyAppBaseActivity.resourceAssembler
I see MyAppBaseActivity and its dependencies on CroutonManager or ConnectionMonitor displayed in the generated point file, so according to this comment, I expected it to be Work. AFAIK, if something is wrong, it should be detected by the assembly with the compiler turned on, which I used to create the point file.
UPDATE:
I previously argued that
In debug mode it will never work
but this is not entirely true after further testing: in Debug mode it does not crash because ProGuard is disabled, while in Release mode it is enabled by default. If I create the application in Release mode, but skip ProGuard , I will not get errors and the application will start successfully. Therefore, the problem is definitely related to my ProGuard configuration.
David Santiago Turiño
source share