Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
IntelliJ Kotlin multiplatform project Gradle sync very long

I've created a new Kotlin Multiplatform project for Andrid and iOS (Mobile shared Library). The project works fine but every time I run Gradle sync, it takes more than 5 minutes every time. It always get stuck on the same line:

Gradle: Build model 'org.jetbrains.kotlin.gradle.KotlinMPPGradleModel' for root project 'MyProject'

Why is it taking so long evey time?

I'm using Gradle version 5.1. Here is my build.gradle file:

buildscript {
    ext.kotlin_version = '1.3.11'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.8.1"
    }
}
plugins {
    id 'kotlin-multiplatform' version '1.3.11'
}
repositories {
    google()
    jcenter()
    mavenCentral()
    maven { url 'https://jitpack.io' }
}
repositories {
    mavenCentral()
}
group 'com.example'
version '0.0.1'

apply plugin: "com.android.library"
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName version
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions.incremental = false
}

kotlin {
    targets {
        fromPreset(presets.android, 'android')
        // This preset is for iPhone emulator
        // Switch here to presets.iosArm64 to build library for iPhone device
        fromPreset(presets.iosX64, 'ios') {
            compilations.main.outputKinds('FRAMEWORK')
        }
    }
    sourceSets {
        commonMain {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
            }
        }
        commonTest {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-test-common'
                implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
            }
        }
        androidMain {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-stdlib'
            }
        }
        androidTest {
            dependencies {
                implementation 'org.jetbrains.kotlin:kotlin-test'
                implementation 'org.jetbrains.kotlin:kotlin-test-junit'
            }
        }
        iosMain {
        }
        iosTest {
        }
    }
}

configurations {
    compileClasspath
}

Screenshot of the problem:

enter image description here

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

There's a known issue where Kotlin/Native dependencies are re-fetched every sync, which may be what you're seeing. You can see details and follow it here.

As posted to that issue, there's a workaround you may be able to try which essentially involves adding { content { excludeGroup("Kotlin/Native" } } to every item in your repositories block.

over 4 years ago · Santiago Trujillo Relatório

0

As @Brucelet pointed out this is a known issue. To supplement his answer, 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")
            }
        }
    }
over 4 years ago · Santiago Trujillo Relatório

0

Try to run the Gradle task from command lines with --parallel option.

Otherwise, fllow this guide to profile Gradle execution https://guides.gradle.org/performance/

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda