Search code examples
gradleintellij-ideakotlinkotlin-multiplatform

Kotlin Multiplatform on IntelliJ is trying to download native dependencies every time


Every time I create a new Kotlin Multiplatform (Mobile shared Library) project in IntelliJ and run Gradle sync, Gradle tries to download native dependencies. This process is long and unsuccessful. Here are some examples of what Gradle is trying to do:

enter image description here enter image description here enter image description here

It makes every sync very long (several minutes). How do I make it stop?

I'm using Gradle 5.1.


Solution

  • As pointed out by @yole, this is a known issue but now there is a workaround. Here is a full implementation of the workaround in Groovy:

    repositories {
        mavenCentral().content() {
            excludeGroup "Kotlin/Native"
        }
        google().content() {
            excludeGroup "Kotlin/Native"
        }
        jcenter() {
            content {
                excludeGroup("Kotlin/Native")
            }
        }
        maven { 
            url 'https://jitpack.io'
            content {
                excludeGroup("Kotlin/Native")
            }
        }
    }
    

    and in Kotlin DSL:

    repositories {
            mavenLocal().apply {
                content {
                    excludeGroup("Kotlin/Native")
                }
            }
            maven {
                url = uri("https://dl.bintray.com/soywiz/soywiz")
                content {
                    includeGroup("com.soywiz")
                    excludeGroup("Kotlin/Native")
                }
            }
            jcenter() {
                content {
                    excludeGroup("Kotlin/Native")
                }
            }
            google().apply {
                content {
                    excludeGroup("Kotlin/Native")
                }
            }
        }