First Kotlin Multiplatform Application - Jedi Needed

Background: Well. I am utterly and completely confused at this point… I used to program in notepad++ mostly, but I’ve switch to IntelliJ IDE for work so I’m trying to use it at home too; I also recently completed the Coursera Kotlin for Java Developers course which is my first dive into Kotlin, but I’m a 15 year polyglot so no issues there. Before this job though I was purist, I never even used GIT let alone all these other development tools like gradle. Needless to say after starting a kotlin template in IntelliJ and finally getting it to build, I think, my project foldr is already at about 500MB in size, and this scares the hell out of my purist sole… not a single line of could and my app is already 100 times bigger than it needs to be. Truly Frightening.

Steps Performed to attempt to setup the project

PREREQUISITS

  • IntelliJ Idea
  • android studio
  • android sdk (installed on first startup of android studio)
  • jdk 8
  • jdk 12
  • git

NEW PROJECT - STEPS PERFORMED

  • Kotlin (MultiPlatform Andriod/IOS) Template

CONFIGURATION:

  • Start and setup android studio.
  • Specify android sdk in local.properties (e.g. C:\Users\username\AppData\Local\Android\Sdk).
  • Restart IntelliJ.
  • IntelliJ Project Structure (button)
    • Project tab: set Project SDK to Kotlin SDK
    • Platform Settings - SDKs (should say 12 and Kotlin SDK)
      • press + and add Android SDK (Build Target: Android API 29, JDK: 12)
  • Build with gradle
    • Fix Android missing file warning
    • Fix Android license agreement warning:
      • Set JRE_HOME environmental variable to JDK 8 (e.g. C:\Program Files\Java\jdk1.8.0_211)
      • navigate to android sdk tools bin (e.g. C:\Users\username\AppData\Local\Android\Sdk\tools\bin) via cmd
      • run sdkmanager.bat
      • run “sdkmanager.bat --licenses” and accept all licenses.
      • run "sdkmanager “build-tools;28.0.2”
      • run “sdkmanager --licenses”, then in IntelliJ select File - Invalidate Caches and Restart
      • copy licenses from android sdk to IntelliJ project (e.g. From C:\Users\username\AppData\Local\Android\Sdk\licenses To D:\Data\Projects\Project\licenses)

My Real Goals in setting up a Kotlin Multi platform Project

  • Be able to wright Kotlin code inside intelliJ on windows 10 as much as possible for target platforms APP (IOS, Android), SERVER (JVM or preferably native linux code if that’s possible so it can run without JVM; MySQL database too), CLIENT (All Browsers, so I think this would be Kotllin compiled to javascript, perhaps with angular2 if that’s possible or recommended).

I’m not really sure if this is achievable but everything I’ve learned seems to indicate it is if you really know what your doing… me I try to understand everything, and 500MB of everything is a lot.

Some questions:

  • how can I really learn gradle well.
  • why does this template:
    • have two graddle files
    • have an iosApp folder
    • why did it create platforms, platform-tools, .gradle build-tools, and other folders when I finally got it to build. Even if needed why didn’t these go into external libraries folder.
    • In my app folder, why are the android folders called Main and Test instead of androidMain/Test keepin with convention of iosMain/Test. Build problems persist if I try to change them.
    • why does android have so many more iml files than the others, and what purpose do these really serve… are they really necessary… folder structure is the first level of organization, this is a messy application from the start.
    • why is my app 500MB before I’ve even written a line of code, can this be avoided or what should I study to learn what this mound of data is.
    • why can’t I seem to figure out how to run the tests in this template.
  • will I be able to write kotlin code for iOS on Windows 10 and run it on some kind of an emulator?

Conclusions
Long story short, if I didn’t have IntelliJ Idea, Gradle and Kotlin as my desired development tools, I’d know exactly what to do… but I choose these tools in an attempt to do things the modern way, the right way, because I assumed it should make life easier… but I’m pretty darn lost at this point.

I created a Kotlin/native app, looks better but still fairly lost.