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

sendoav

10/16/2020, 8:25 AM
Hi All! I have recently updated to kotlin 1.4.0 and when trying to execute the compileKotlinIos task I get "java.io.FileNotFoundException: /../build/classes/kotlin/ios/main/presentation/manifest (No such file or directory)"
a

Artyom Degtyarev [JB]

10/16/2020, 8:35 AM
Hello, @sendoav! Could you please share what does the Gradle script look like? I would guess the problem is naming-related or something.
s

sendoav

10/16/2020, 8:40 AM
Copy code
apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.multiplatform'
apply plugin: 'co.touchlab.kotlinxcodesync'
apply plugin: 'dev.icerock.mobile.multiplatform-resources'
apply from: './jacoco.gradle'


version = "1.0"

android {
    signingConfigs {
        debugSign {
            storeFile file("$projectDir/ideConfig/debug.keystore")
            keyAlias "androiddebugkey"
            keyPassword KEY_PASSWORD_D
            storePassword KEYSTORE_PASSWORD_D
        }
        releaseSign {
            keyAlias "Ekasa"
            keyPassword KEY_PASSWORD_R
            storeFile file("$projectDir/ideConfig/retabet.jks")
            storePassword KEYSTORE_PASSWORD_R
        }
    }
    compileSdkVersion Versions.androidCompileSdkVersion
    buildToolsVersion Versions.androidBuildToolsVersion

    defaultConfig {
        minSdkVersion Versions.androidMinSdkVersion
        targetSdkVersion Versions.androidTargetSdkVersion
        versionCode Versions.androidVersionCode
        versionName Versions.androidVersionName
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        debug {
            matchingFallbacks = ['release']
            testCoverageEnabled = true

        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "$projectDir/proguard-rules.pro"
            proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "$projectDir/proguard-rules.pro"
            debuggable false
            jniDebuggable false
            renderscriptDebuggable false
        }
    }

    sourceSets {
        main.java.srcDirs += 'src/commonMain/kotlin'
    }

    lintOptions {
        abortOnError false
    }


    testOptions {
        unitTests.returnDefaultValues = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    configurations.all{
        resolutionStrategy {
            exclude group: "org.jetbrains.kotlinx", module: "kotlinx-coroutines-debug"
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude("META-INF/*.kotlin_module")
    }
}

dependencies {
}

multiplatformResources {
    multiplatformResourcesPackage = "ekasa.com.reabet"
}


kotlin {
    targets {
        targets.fromPreset(presets.android, 'android')

        def buildForDevice = project.findProperty("device")?.toBoolean() ?: false
        def iosPreset = (buildForDevice) ? presets.iosArm64 : presets.iosX64
        fromPreset(iosPreset, 'ios') {
            binaries {
                framework {
                    // Disable bitcode embedding for the simulator build.
                    if (!buildForDevice) {
                        embedBitcode("disable")
                    }
                    export(project(":kotlinMPP:domain"))
                    // Export transitively.
                    transitiveExport = true
                }
            }
            binaries.all {
                freeCompilerArgs += "-Xg0"
            }
        }
    }

    sourceSets {
        androidMain {
            dependencies {
                implementation GeneralDependencies.kotlinCoroutinesAndroid
                implementation "androidx.annotation:annotation:1.1.0"
            }
        }
        commonMain {
            dependencies {
                implementation GeneralDependencies.klock // Common
                api project(':kotlinMPP:domain')
                api project(':kotlinMPP:common')
                implementation GeneralDependencies.kotlinCore
                implementation GeneralDependencies.reaktive
                api GeneralDependencies.mokoResources

            }
        }
        commonTest {
            dependencies {
                implementation kotlin('test-common')
                implementation kotlin('test-annotations-common')
                implementation TestDependencies.mockk
            }
        }
        iosMain {
            dependencies {
                //implementation GeneralDependencies.kotlinCoroutinesNative
                api "co.touchlab:crashkios:0.3.0"
            }
        }
        androidTest {
            dependencies {
                implementation kotlin('test')
                implementation kotlin('test-junit')
                implementation 'com.android.support.test:runner:1.0.2'
                implementation TestDependencies.coroutinesTest
            }
        }
    }
}

xcodeSync {
    projectPath = "../../iOSApp/retabet.xcodeproj"
    target = "retabet-debug"
    group = "KotlinPresentation"
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

task copyFramework {
    def buildType = project.findProperty("kotlin.build.type") ?: "DEBUG"
    dependsOn "link${buildType.toLowerCase().capitalize()}FrameworkIos"

    doLast {
        def srcFile = kotlin.targets.ios.binaries.getFramework(buildType).outputFile
        def targetDir = getProperty("configuration.build.dir")
        copy {
            from srcFile.parent
            into targetDir
            include 'presentation.framework/**'
            include 'presentation.framework.dSYM'
        }
    }
}

task doCopyResouces{
    copy {
        from 'build/generated/moko/iosMain/res'
        into '../../iosApp/retabet/res/'
    }

    copy {
        from 'build/generated/moko/androidMain/res/values/'
        into '../../androidApp/view/src/main/res/values/'
    }
}

task copyResourcesTask {
    dependsOn ':kotlinMPP:presentation:generateMRiosMain'
    doLast {
        doCopyResouces
    }
}


preBuild.dependsOn(copyResourcesTask)
a

Artyom Degtyarev [JB]

10/16/2020, 9:00 AM
Thanks, please also run
./gradlew compileKotlinIos --info
for the details.
s

sendoav

10/16/2020, 9:03 AM
ok
umm it does not explain anything else, only that the file is missing
a

Artyom Degtyarev [JB]

10/16/2020, 10:10 AM
Okay, could you post a complete Gradle output? There should be more information about arguments Kotlin/Native compiler being called with.
s

sendoav

10/16/2020, 10:50 AM
i

ilya.matveev

10/16/2020, 11:02 AM
At the first sight there is nothing wrong in this log. Let's try to collect more data. Could you please rerun the build with
--info --stacktrace --scan
flags and send us the link to the buildscan?
s

sendoav

10/16/2020, 11:09 AM
thanks by the way
i

ilya.matveev

10/16/2020, 11:13 AM
Copy code
Caused by: java.io.FileNotFoundException: /Users/arantza/Apps/RETAapp/kotlinMPP/presentation/build/classes/kotlin/ios/main/presentation/manifest (No such file or directory)	
    at dev.icerock.gradle.generator.ios.IosMRGenerator$setupKLibResources$1.execute(IosMRGenerator.kt:91)	
    at dev.icerock.gradle.generator.ios.IosMRGenerator$setupKLibResources$1.execute(IosMRGenerator.kt:25)	
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726)	
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693)
It seems that you use an old version of the
dev.icerock.mobile.multiplatform-resources
plugin. Try to update it to
0.13.1
(see https://github.com/icerockdev/moko-resources).
s

sendoav

10/16/2020, 11:18 AM
superthanks! That was the problem
👍 1
5 Views