ton-kotlin
ton-kotlin copied to clipboard
Enable Android platform support
To use the library in Android projects, 'android()' platform support must be enabled. To do so, it need to apply Android Gradle Plugin for the configuration phase, apply android library plugin com.android.library
for each multiplatofrm module, setup android
configuration with fresh verisons of the android SDK (compileSdk = 33, targetSdk = 33, minSdk = 21 or older), create androidMain
sourcesets and place manifest androidMain/AndroidManifest.xml
to each sourceset with different packages.
And as I beleive, there are some problems with the current project configuration for multiplatform. jvmMain
and androidMain
- is different sourcests for KMM (because some differents with API in Java, as I understand). So, it will need to either copypaste the code of actual implementations, or rework structure of sourcesets.
And it is impossible to enable two plugins at the same time in the same module - com.android.library
and java
. At now java
plugin applied in ton-kotlin-fift
module.
Some links on the topic:
- About KMM project structure: https://kotlinlang.org/docs/multiplatform-mobile-understand-project-structure.html
- About Android build configuration: https://developer.android.com/studio/build
And some projects with KMM in which android and jvm are enabled:
- https://github.com/touchlab/Kermit
- https://github.com/arkivanov/Essenty
- https://github.com/icerockdev/moko-resources