https://kotlinlang.org logo
#android
Title
# android
e

Eric Martori

08/23/2019, 9:05 PM
I don't know if this is the correct channel for this question, so forgive me if it is not the correct place. I want to add dependency:
androidx.lifecycle:lifecycle-runtime-ktx:$androidLifecycle
in a library project If I add this dependency in an Android library project there is no problem, but if I add this dependency in a normal kotlin library the extension functions cannot be found. This import statement stops working:
import androidx.lifecycle.lifecycleScope
But this doesn't:
import androidx.lifecycle.LifecycleOwner
I am creating a library that have a dependency on the androidx lifecycle but I don't need resources or access to any normal
android.*
dependency, that's why I'm trying to use a normal kotlin library instead of an android library Any idea on why this is happening?
v

voben

08/23/2019, 9:15 PM
You’re trying to import an android dependency into a non-android project
2
e

Eric Martori

08/23/2019, 10:10 PM
but
androidx.lifecycle:lifecycle-runtime-ktx
doesn't have direct dependencies on android. And it doesn't explain that for example
LifecycleOwner
is available but an extension on it isn't