Hello guys. I am writing an Espresso tests and fac...
# koin
e
Hello guys. I am writing an Espresso tests and face strange problem with module logic. I need to release on of my modules. All other modules start in app, and only this one starts in activity. As each Espresso test will launch different instance of Activity I need a way to release this module after each Espresso test is finished. I read about module path and change this
Copy code
val moduleName: Module = module {
    single {... }
    single { ...}
    factory { ...}
}
to this
Copy code
val moduleName: Module = module(path = "ModuleName") {
    single {... }
    single { ...}
    factory { ...}
}
And after this small change I receiving an error when launching the app.
Copy code
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
     Caused by: org.koin.error.BeanInstanceCreationException: Can't create definition for 'Factory [name='HomeViewModel',class='com.devindi.wallpaper.home.HomeViewModel', binds~(android.arch.lifecycle.ViewModel)]' due to error :
    		Can't proceedResolution 'class com.devindi.wallpaper.model.map.MapAreaManager (Kotlin reflection is not available)' - Definition is not visible from last definition : Factory [name='HomeViewModel',class='com.devindi.wallpaper.home.HomeViewModel', binds~(android.arch.lifecycle.ViewModel)]
Does anybody know what is the problem when adding path to the module constructor? Or probably there is an easier way to release specific module, without adding module path. Thanks.