https://kotlinlang.org logo
#dagger
Title
m

Marko Novakovic

02/07/2022, 9:33 AM
am getting
Component not initialized
when running tests
hey
I was able to fix it
inside your
andriodTest
create separate
Manifest.xml
file and define startup inside of it and disable automatic initialization
do it manually
j

Jay Barria

03/13/2022, 11:53 AM
I created
AndroidManifest
inside
androidTest
added
tools:node="remove"
to disable automatic initialization but still failed to create the hilt component for testing. In my case it's not merging at all with the
main
app manifest. So I ended up refactoring the startup, removing manifest initialization for the
main
app altogether and manually triggering the startup inside the Application class. Not ideal, but I didn't had any espresso UI testing issues before migrating Dagger to Hilt.
z

Zsolt.bertalan

03/14/2022, 9:12 AM
@Marko Novakovic @Jay Barria Thank you for your replies. Sorry, I noticed your replies only now, so I will work on it now, trying your recommendations, too.
Unfortunately androidTest manifest is not overriding the main manifest, so I had to do what Jay recommended. It seems to work, thank you all.
👍 1
e

Enrico Del Zotto

07/12/2023, 2:05 PM
Got same issues… so in short you avoid the manifest init
the only thing they just decided not to use their own library
101 Views