David Stolarsky
05/02/2019, 9:59 AMbuild.gradle
ribesg
05/02/2019, 10:42 AMjvm
target and naming it android
does not make it an android
target. Use the android
preset, the android plugin and have a proper android block.ribesg
05/02/2019, 10:42 AMribesg
05/02/2019, 10:43 AM.aar
file) or an Android application (.apk
file)David Stolarsky
05/02/2019, 11:16 AMfromPreset(presets.jvm, 'android')
) straight from the "Multiplatform Project: iOS and Android" tutorialDavid Stolarsky
05/02/2019, 11:18 AMplatform.UIKit
, so i assumed it was nearly demonstrating how to use platform.android
. but i guess it is still a bit far from demonstrating platform.android
use.ribesg
05/02/2019, 11:18 AMribesg
05/02/2019, 11:19 AMplatform.*
is a native thing. Android isn’t native (or at least that’s not what you want). To clarify, there’s no platform.android
. You would just import Android APIs normally like in a normal Android projectDavid Stolarsky
05/02/2019, 11:21 AMimport platform.android.*
in a couple examplesDavid Stolarsky
05/02/2019, 11:24 AMDavid Stolarsky
05/02/2019, 11:24 AMDavid Stolarsky
05/02/2019, 11:24 AMribesg
05/02/2019, 11:25 AMplatform.android
, but for Android Native development, which is a very different thingDavid Stolarsky
05/02/2019, 11:26 AMribesg
05/02/2019, 11:26 AMDavid Stolarsky
05/02/2019, 11:26 AMribesg
05/02/2019, 11:26 AMDavid Stolarsky
05/02/2019, 11:27 AMapply plugin("com.android.library")
and an android { }
block?David Stolarsky
05/02/2019, 11:27 AMribesg
05/02/2019, 11:27 AMandroid
target work? An Android target is surprisingly harder to setup than a native one because you have to setup the whole android library thingribesg
05/02/2019, 11:27 AMDavid Stolarsky
05/02/2019, 11:27 AMribesg
05/02/2019, 11:28 AMandroid()
instead of some fromPreset thingDavid Stolarsky
05/02/2019, 11:28 AMDavid Stolarsky
05/02/2019, 11:29 AMribesg
05/02/2019, 11:29 AMribesg
05/02/2019, 11:30 AMDavid Stolarsky
05/02/2019, 11:33 AMDavid Stolarsky
05/02/2019, 11:33 AMDavid Stolarsky
05/02/2019, 11:33 AMribesg
05/02/2019, 11:33 AMDavid Stolarsky
05/02/2019, 11:34 AMribesg
05/02/2019, 11:34 AMDavid Stolarsky
05/02/2019, 11:34 AMDavid Stolarsky
05/02/2019, 11:34 AMribesg
05/02/2019, 11:35 AMandroid {
compileSdkVersion(Versions.androidCompileSdk)
defaultConfig {
minSdkVersion(Versions.androidMinSdk)
targetSdkVersion(Versions.androidTargetSdk)
versionName = Versions.appVersionName
versionCode = Versions.appVersionCode
}
sourceSets {
getByName("main") {
setRoot("src/androidMain")
}
getByName("test") {
setRoot("src/androidTest")
}
}
lintOptions {
isAbortOnError = false
}
}
ribesg
05/02/2019, 11:35 AMribesg
05/02/2019, 11:35 AMribesg
05/02/2019, 11:36 AMDavid Stolarsky
05/02/2019, 11:36 AMribesg
05/02/2019, 11:36 AMribesg
05/02/2019, 11:37 AMribesg
05/02/2019, 11:38 AMandroid {
publishAllLibraryVariants()
}
(You can customize which variants are published, but if you only got release and debug variants, that works)David Stolarsky
05/02/2019, 11:40 AMribesg
05/02/2019, 11:40 AMDavid Stolarsky
05/02/2019, 11:41 AMgetByName("main")
.... what does "main"
refer to?David Stolarsky
05/02/2019, 11:41 AMmain
somewhere?David Stolarsky
05/02/2019, 11:43 AMsrc/commonMain/kotlin
, src/androidMain/kotlin
, and src/iosMain/kotlin
ribesg
05/02/2019, 11:45 AMribesg
05/02/2019, 11:45 AMgetByName("main")
with just main
ribesg
05/02/2019, 11:46 AMsourceSets
block in the android
block is to just change main
to androidMain
, at least for the sourceSet locationDavid Stolarsky
05/02/2019, 11:48 AMandroidMain/
David Stolarsky
05/02/2019, 11:48 AMDavid Stolarsky
05/02/2019, 11:48 AMribesg
05/02/2019, 11:49 AM<?xml version="1.0" encoding="utf-8"?>
<manifest package="yourpackage" />
ribesg
05/02/2019, 11:50 AMDavid Stolarsky
05/02/2019, 11:51 AMDavid Stolarsky
05/02/2019, 11:53 AMimport android.
.... stuff nowDavid Stolarsky
05/02/2019, 11:53 AM