Hello, everyone
Maybe silly question but I am not very familiar with Gradle. I am using IDEA, selecting : new project - kotlin- mobile shared library. Because according to description this type of project allow to share code between jam/Android and Native.
At the start ide create to targets : iOS and jvm, it’s okay, but I want to use Android classes in jvm module (like SharedPreferances) to implement platform specific solution. But I can’t do it. How I can achieve it?
I saw different projects that implement such behavior, but they use different project structure, I don’t really understand how to apply it here.
I rad docs about multi platform projects on
kotlinlang.org and found that they have different target types, including ‘android’. But when I try to add new target using : ’fromPreset(presets.android, ‘library’)’ I got error : ’Extension with name ‘android’ does not exist.’. I tried to follow this error and tried to solve it (adding gradle plugin, setting up different keys and sections in build.gradle file), but it always lead to kind of chaos in project at the end and I still can’t use android classes in jvmModule.
Can someone please explain me how I can use android classes to implement platform specific implementation of common module? I put project what IDEA created here, in case you will need to see sources (
https://github.com/nbaklanov-issart/multiplatform-prg-example).
What I need to do? Add another target? Or depency? Or something else.