**implementation 'io.insert-koin:koin-android:3.4.0'**
class SplashActivity: AppCompatActivity() {
private val viewModel: SplashViewModel by viewModel()
...
class MyApplication: Application() {
override fun onCreate() {
super.onCreate()
startKoin {
androidLogger(Level.ERROR)
androidContext(this@MyApplication)
androidFileProperties()
koin.loadModules(getAllModules())
}
}
...
val presentationModules = module {
viewModel {
SplashViewModel(
urlUseCase = get(),
)
}
}
val mapperModules = module {
single(named(urlResponseToUrlAddress)){
UrlResponseToUrlAddress()
}
}
...
object AppComponent {
fun getAllModules(): List<Module> = listOf(*getAppModules())
private fun getAppModules(): Array<Module>{
return arrayOf(
domainModules,
mapperModules,
dataModules,
otherModules,
presentationModules,
)
}
}
ERROR:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/koin/android/ext/android/AndroidKoinScopeExtKt;
I'm trying to implement KOIN in my app. But I always get this error.
It seems that you have an issue with the Koin library; make sure you have added the koin for android dependency: `implementation 'io.insert-koin:koin-android:3.4.0', or try cleaning and rebuilding your project, lot of issues are solved like that!