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

Gunslingor

04/08/2020, 8:57 AM
Yeah... I'm about to give up on this whole dam platform. I'm done for the night.
k

kpgalligan

04/08/2020, 12:54 PM
Going back to the previous thread, what issues are you running into? I wouldn’t necessarily dump your current config and use a separate template. It would be easier to help if this were public code we could look at.
To be sure, the config can be difficult to understand. We’ve been working a lot on onboarding docs for native mobile. This is “another template”, but it’s more about the docs and seeing the config. Feel free not to use the template, but you might find something in the config to help. https://github.com/touchlab/KaMPKit
g

Gunslingor

04/08/2020, 5:08 PM
My issues are vast at this point: there a reoccuring build error messages from gradle or intelliJ, there is disorder from the way the multiplatform and android plugins are designed (tasks/folders, its a mess, many don't work, don't know which I need) and I have resulting issues with the way the KampKit project (and all similar projects I've seen) is setup... I don't believe in starting directly with someone elses template unless I understand 99% of everything in it. I studied all the intelliJ Kotlin, gradle, android templates... I must have made 100 templates while researching and I feel I understand much, 95%, good enough. But there is no template for jvm/js/ios/android/common all together, so I've turned to 5-10 templates like this one, there are slight differences between them but the overall Philosophy is the same. I tend to disagree with some of the layout philosophy (though my mind is open to convincing otherwise) and I suspect I've made my task tough for trying to build it a little differently... but it really shouldn't have caused this much pain, I'm only really trying to change the location of a few folders. I can share my code with you, project is still early... but I can't make the repo public. I could also provide you with a psuedo template if you want, which should show you what I would really like and so maybe you could tell me if that's achievable.
Yeah... I understood just about every gradle task when my project was just jvm/js and just by bringing in android I feel the entire thing is a big mess... I have mostly given up on my dream of a different template vision and I'm just trying to merge your type in but I haven't pushed a commit in weeks because I can't even get that to work right.
Here is my dream template, essentially your project but reorganized; anyone feel free to look and let me know if I'm crazy or not, lol. I will send you my actualy personal project via slack messaging sir, this is just a folder layout, thanks!
k

kpgalligan

04/08/2020, 5:30 PM
“just by bringing in android I feel the entire thing is a big mess” I don’t really have good answers there, other than working through the errors to get the build working. The Android plugin is in Google’s hands. Interacting with it can generally be difficult and brittle, as they’ve added quite a bit of custom stuff that’s Android-specific. I think it would be best to do a “psuedo template” and get kind of a team effort going to sort out issues. That way there’s a functional “template” at the end that is what you’re looking for. Also, my availability is spotty at best.
g

Gunslingor

04/08/2020, 5:32 PM
No worries man, take a look at the psuedo template I just attached, should take less than 45 seconds to understand what my brain is telling me is best
One of the strangest things is that I can't import kotlin("android") anywhere in the project, I suspect because of multiplatforrm... but I think I recall reading on an obscure post a while back that it was obsolete and included in some version of something else I was already using.
k

kpgalligan

04/08/2020, 6:11 PM
Not clear on what
kotlin("android")
is? As a dependency?
Took a quick look at the zip you sent. “hate having that stuff in root” I don’t have much comment on custom gradle setups. There’s a lot you could probably do, but I fall in the camp of moving as little as possible because your config gets painful, as you’ve experienced. I’m not a gradle expert by any means, though
g

Gunslingor

04/08/2020, 6:13 PM
Copy code
plugins {
    id("com.android.application")
    id("kotlin-android")
    id("kotlin-android-extensions")
}
the last two plugins break my app beyond belief
sorry, misrecalled
I got yeah... the gradle part is a wishlist, what about getting rid of shared, separate src/test like my folders, app/ios in androidMain and iosMain, is the even possible?
Well... time to move on I guess, guess your right... my dream is too custom. I would have to say that the standard setup is too delicate to be standard, lol, been a nightmare to reproduce even with goby's galore... I just really though this gradle multiplatform stuff was more easily flexible. I'll find a template the works perfectly and try to merge my stuff into it I guess, no other option at this point. Kamp is a contender.
r

rudolf.hladik

04/08/2020, 7:17 PM
if you use kotlin dsl you have to specify it as
Copy code
plugins {
    id("com.android.application")
    kotlin("android")
    kotlin("android.extensions")
}
g

Gunslingor

04/08/2020, 7:20 PM
Plugin [id: 'org.jetbrains.kotlin.android'] was not found in any of the following sources
Copy code
plugins {
    id("com.android.application")
    kotlin("android")
    kotlin("android.extensions")
}
repositories {
    google()
}
I've tried everything.
Note I don't have a lot of red without it, tasks just fail...
r

rudolf.hladik

04/08/2020, 7:25 PM
where do you apply those plugins?
g

Gunslingor

04/08/2020, 7:26 PM
root/app/build.gradle.kts is where they are supposed to go, but tried every build file.
r

rudolf.hladik

04/08/2020, 7:31 PM
your project structure seems odd to me. I have the structure like this
its only android, ios and common but js should be just one more module
g

Gunslingor

04/08/2020, 7:32 PM
Yeah, I was going from jvm/js project to include an android app that reads from the jvm
Yeah.. thinking I have a new path forward... the piece that is killing me is this androidMain component that is considered a library that gets injected into an App and used... I don't need a library for android, I don't need a library for anything, I just need android with the capacity to use common ideally but that's a secondary goal at this point, I just working android... certainly I don't consider myself to be writing any libraries, I'm writing applications... 1 ios, 1 android, 1 jvm that serves kotlin generated html/css/js and reset jsons from a DB. I think I'm going to go back to my ideal project template, create an isoalted android app inside src/android/app and move forward... I'm already liking the way my gradle tasks are far better organized. What happens next is on me, lol, will let know know where I end up.
k

Kweku

04/09/2020, 11:33 PM
Can you not share your build.grade files and project structure?
g

Gunslingor

04/09/2020, 11:43 PM
I could pm it if needed, I don't have on github yet, but I think I've decided to do my apps in dart... it was so much easier to setup and just makes more sense to me, and it files a need multiplatform didn't, common app frontend design... not having to learn too much iOS makes me happy. I still have my server and and js in kotlin multiplatform, that still makes sense to me; likely going to continue trying to make a website entirely out of kotlin with a rest feeding the darp apps... or maybe I merge that into dart later too, don't know, dart doesn't seem appropriate for server... I like Kotlin for 2 main reasons: a) I've hated java for 20 years and b) the promise of writing everything in one language is something I've wanted for 20 years... I like Kotlin better as a language than dart for sure, but I've been experimenting with app frameworks for months and never got a ground up kotlin multi-platform project to work with all possible targets, all tasks... even the examples had failed tasks, and the tasks were all mixed together and overdone, poorly explained.... teh iOS/android only project works okay... but for me the business logic is far more trivial than the view, so again dart wins out on approach there for me.
4 Views