Hello all, I’ve been working on building a multi p...
# multiplatform
b
Hello all, I’ve been working on building a multi platform project for Kotlin to support multiple android and ios apps in a single project. I have had some success in accomplishing this, my projects will build happily so that is quite exciting for me. Now I have come to the situation where in my IntelliJ I am attempting to use the
actual
keyword on a class to implement an expect. IntelliJ gives me the warning:
The feature "multi platform projects" is experimental and should be enabled explicitly
I have found that in IntelliJ there would be an expectation under :
Copy code
Preferences -> 
  Build, Execution, Deployment ->
    Kotlin Compiler ->
      Additional command line parameters:
To add the flag
-Xmulti-platform
I am driving my project settings from gradle and found I can include this block for my subprojects:
Copy code
targets.all {
    compilations.all {
        kotlinOptions {
            freeCompilerArgs += '-Xmulti-platform'
        }
    }
}
I am still getting the error and it does not seem to have any effect in the IDE understanding that the feature has been adjusted. Am I missing something obvious here? Did I implement my gradle wrong?
Took me a while but I finally found my answer. In the individual app build gradle (Specifically for android… we’ll see about other modules) I had to add
Copy code
buildTypes {
        all {
            kotlinOptions {
                freeCompilerArgs = [
                       '-Xmulti-platform',
                       '-Xuse-experimental=kotlin.Experimental'
                ]
            }
        }
}
Tried this in many other places to no avail.
g
I don't think that -Xuse-experimental for Experimental annotation makes any sense for your case
b
It was for another reason, I just forgot to remove it. Thanks though
g
What kind Gradle plugin do you use? Because I don't remember such warning if you use recommended kotlin-multiplatform Gradle plugin
b
I am using the kotlin-multiplatform plugin. That’s why it’s so confusing to me. I was able to sort out all of my issues before ending my day yesterday, and now have a fully building multiplatform project.
g
Maybe you have this warning in some module that doesn't use MPP plugin? But not 100% sure that this warning is not present if you use MPP plugin