Dagger does not generate class for TestComponent
See original GitHub issueI’m trying to run your project in Android studio bug I’m finding a problem. Dagger does not seem to generate the Dagger class for the TestComponent defined in ActivityLauncher. I found the same issue in my own code and I’d like to know if there is anything else I’m supposed to do. ActivityLauncher line 34 shows an error where DaggerActivityLauncher_TestComponent is not found.
DemoApplication app
= (DemoApplication) fetchInstrumentation().getTargetContext().getApplicationContext();
TestComponent component = DaggerActivityLauncher_TestComponent.builder()
.mockClockModule(new MockClockModule())
.build();
app.setComponent(component);
Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Dagger not generating components for /test class
Dagger does not, however, generate code for the Component builders in src/test. My main build.gradle: dependencies { classpath 'com.android.
Read more >Unable to generate TestComponent after update to 2.21+ #1599
We don't run FindBugs on UnitTest classes, so we don't need that annotation. But since it's not stripped dagger fails on that.
Read more >Dagger annotation processor does not generate classes when ...
Create a Main class whose main method just calls DaggerAppComponent.create() . What is the expected result? The project should be able to compile...
Read more >Testing with Dagger
It is generally recommended to create a Dagger component in your tests to instantiate objects, whether that is a larger test component for...
Read more >5 steps to understand Dagger 2 - ProAndroidDev
04 Injection: create a test application class inherited from DaggerTutoApplication. We will instantiate our test component there, before injecting it into the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
DaggerActivityLauncher_TestComponent
does not get generated until you build the test.To build the test, open
MainActivityTest.java
, right click onpublic class MainActivityTest
, and choose Run -> MainActivityTest (the one with the Android icon).I spent time a lot for understand that . Thank you so much for help !