I’m trying to add these dependencies, any help ple...
# multiplatform
b
I’m trying to add these dependencies, any help please
c
If you are using the
kotlin()
function then you dont need the full path. You can either do
api(...)
or
api(kotlin(std-lib-common))
I dont know if these work exactly as I have them, but the point is that you are mixing
kotlin()
and the full path.
k
And You can’t add android dependencies to common source set Try to move android dependencies to separate block
Copy code
val androidMain by getting {
            dependencies {
                implementation("androidx.core:core-ktx:1.3.1")
            }
        }
2
b
@Kamil Kalisz not sure what that means
k
so In common source set you should define only dependencies that will be used by all targets.
so android VIewModel/LiveData dependency should be in androidMain instead of common main
b
but the structure is the viewModel should be in the KMM layer right?
k
but “androidx-lifecycle” can be used only on android. So you need to have your own abstraction layer
you can try to use some existing libraries
x
you can also use `expect`/`actual` pattern to define your own
ViewModel