The example <Quickstart-Android-ViewModel> does no...
# koin
n
The example Quickstart-Android-ViewModel does not seem to work. I am unable to import the
get()
, and the application crashes on startup. Is the documentation incomplete or am I missing something? I am trying this in a minimal Compose app using Koin v. 3.1.6
Copy code
val appModule = module {
    // MyViewModel ViewModel
    viewModel { MyViewModel(get()) }
}
Turns out that it’s the
androidLogger()
that is causing the crash. If I comment out this line, then the app builds and runs.
Copy code
class MyApplication : Application(){
    override fun onCreate() {
        super.onCreate()
        // Start Koin
        startKoin{
            androidLogger()
            androidContext(this@MyApplication)
            modules(appModule)
        }
    }
}
The error message:
Copy code
java.lang.NoSuchMethodError: No static method toDouble-impl(JLjava/util/concurrent/TimeUnit;)D in class Lkotlin/time/Duration; or its super classes (declaration of 'kotlin.time.Duration' appears in /data/app/~~42eIZ0Lt8qeHdx0T9j6fIw==/net.nkl3in.ktorauth-6spPD0q9sBe4yl3Row5oqA==/base.apk)
        at org.koin.core.time.MeasureKt.measureDuration(Measure.kt:32)
m
what Kotlin version did you use?
n
That's exactly the issue, thank you, great find. Apparently version 3.2.0 will allow for Kotlin 1.6.x - have you worked with any of the pre release versions of 3.2?
✔️ 1
m
currently no, atm