Th" /> Th" /> Th"/>

Skip androidx.startup when running instrumented tests

62 views Asked by At

I have some startup initializers defined in my manifest file.

<meta-data
  android:name="com.myapp.MyInitializer"
  android:value="androidx.startup" />

That initializer is being run when I run my instrumented tests, really slowing things down. Is there a way to disable startup when running android instrumented tests?

2

There are 2 answers

0
Sumit Jangir On

Then you should remove Automatic initialize components by replacing

android:value="androidx.startup"

with this

tools:node="remove"

Now you have to Manually initialize components whenever you want

AppInitializer.getInstance(context)
.initializeComponent(MyInitializer::class.java)

Like this.

You can read this for more reference

Manually initialize components

0
Adarsh Suryawanshi On

replace android value for startup with following android:value="androidx.startup" =>
tools:node="remove"