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

deviant

07/23/2021, 3:55 PM
hey guys, is it normal for kmm project? each time i change 1 line of code and try to rebuild - it's starting the cold build process with redownloading all dependencies etc. sometimes it takes like 40 mins. is it kmm plugin bug or android studio? can't find matching issue in the bug tracker
l

Landry Norris

07/23/2021, 6:57 PM
One of my co-workers had a similar issue. He set up the build folder on a RAM drive, and said the time went down from 1 hour to 20 minutes.
d

deviant

07/23/2021, 7:05 PM
sounds promising 😄
l

louiscad

07/23/2021, 11:19 PM
Kotlin 1.5.21?
c

CLOVIS

07/24/2021, 5:23 PM
I'm using multiplatform with JVM, JS and Android and never had anything like that. Do you have any more details on what exactly happens?
l

Landry Norris

07/24/2021, 5:33 PM
It's compiling it as several "separate" projects, so that may have an effect on speed. It seems very storage speed bound.
m

Matthias Geisler

07/24/2021, 5:59 PM
Sounds like you are doing something with Native...Actually the linker takes freaky long time to do his job...however somebody noticed that BuildCaches helps...but I did not had the time to try it myself...
m

Mayank

07/25/2021, 8:45 PM
Try Gradle offline mode. It should reduce the time.
d

deviant

07/26/2021, 6:51 AM
yeah, offline mode helps. but why? looks like a bug for me. tried 1.5.10, 1.5.21. no defference. my project for now is just almost hello world kmm (android+ios) and jetpack compose
c

CLOVIS

07/26/2021, 9:51 AM
We can't know why it does that without more info. What exactly is your config?
d

deviant

07/26/2021, 9:54 AM
sure. we started our project following the oficial guide. created new kmm project in latest AS canary. added few libs like coroutines, moko, jetpack compose. we use gradle kotlin dsl for all scripts (may it be the root of all problems?). for now we are playing with android app only.
c

CLOVIS

07/26/2021, 9:55 AM
Do you have the same problem with the hello world/template project?
d

deviant

07/26/2021, 9:57 AM
i don't think so. but i already guess it should be fine since i'm the only person here who get this issue 🙂 let me check
m

Mayank

07/26/2021, 2:26 PM
My team was facing this exact issue. Gradle sync was fast in offline mode but too slow otherwise. We couldn’t find a solution until one day CI started failing. We found that dependency was getting resolved from wrong repository. And then it clicked that this could also be the reason for slow sync. We removed some unused repositories and rearranged them. It resolved the issue. I don’t know why gradle was downloading dependencies on every sync and couldn’t find anything on the net. But am content that its atleast fast now
👍 1
d

deviant

07/26/2021, 2:33 PM
@Mayank could you elaborate what exactly was the dependency/repo?
m

Mayank

07/26/2021, 2:35 PM
The root gradle buildscript repositories. We reordered them to
Copy code
buildscript {
    repositories {
        mavenLocal()
        gradlePluginPortal()
        google()
        mavenCentral()
         maven { url = uri("<https://dl.bintray.com/some_other_repo>") }
    }
}
Moving bintray repo to the bottom made a huge impact
all the things 1
👍 1
l

louiscad

07/26/2021, 2:42 PM
You can just remove it, bintray repos are all offline now, killed by the sunset. Only jcenter is still around, read-only.
👍 1
d

deviant

07/27/2021, 10:35 AM
i have a progress on this 🙂 shuffled the repositories section a bit, and now crazy infinite dependencies donwloading gone. but now i stuck on the
Build model...
and
Download maven-metadata.xml
. 21 min so far...
l

louiscad

07/27/2021, 1:32 PM
Downloading such a file should take about 2 seconds on a 2G connection (Edge), and less than a second over other connections.
d

deviant

07/27/2021, 1:40 PM
i know man 🙂 but my colleague has same issue in a totally different environment (same project). i'll try to investigate verbosed logs. unfortunately can't spend much time on this (not our main project, rather an early stage investigations)
eventually figured out. you guys were right, it was a nasty bintray repo 🤦 now builds like a hurricane! case closed
👍 1
🙂 1
3 Views