https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
g

galex

01/26/2019, 6:05 AM
Do someone know how to add a sourceset to the android target?
Are you using the kotlin-dsl or groovy?
g

galex

01/26/2019, 11:31 AM
Groovy. I understand I’ve got to add “dependsOn” in the sourceset of the android target but I’ve tried android, androidMain, androidDebug, etc. and none really added the source set
Hmm I see here that androidMain should work https://github.com/JetBrains/kotlin-native/issues/2577
d

Dominaezzz

01/26/2019, 11:42 AM
Have you declared the android target?
Like the
android()
or
fromPreset(presets.android, 'android')
?
g

galex

01/26/2019, 11:53 AM
android() yes
the source folder for android is just “main” right, like in a general android app?
I’ve tried to add an “androidMain” source set folder right now and there as well I do not have access to the custom source set I defined
(thanks a lot for helping me btw!)
OMG! it is actually working in Gradle but NOT in IntelliJ
So I have an expect class in the custom source set, and have added an actual class in the “main” folder source code
Actual val for an expect val in a custom source set
d

Dominaezzz

01/26/2019, 12:07 PM
Did you create the project via IDEA?
g

galex

01/26/2019, 12:07 PM
Yes I did
If I comment this line, I get the following error while trying to build the android lib “Expected property ‘ApplicationDispatcher’ has no actual declaration in module ”
Btw, this expect val is correctly implemented in a js(‘node’) module and I have access to the rest of the custom source set code
d

Dominaezzz

01/26/2019, 12:10 PM
Have you applied any android plugins?
g

galex

01/26/2019, 12:11 PM
Yup: apply plugin: ‘com.android.library’ apply plugin: ‘kotlin-multiplatform’ apply plugin: ‘maven-publish’
d

Dominaezzz

01/26/2019, 12:18 PM
I'm guessing you're on
1.3.20
?
g

galex

01/26/2019, 12:26 PM
Yes indeed
2 Views