'Execution failed for task ':generateMetadataFileForIosArm64Publication'

I am reading this Creating your first Kotlin Multiplatform library. I updated the maven-publish Gradle plugin. After that I run the command ./gradlew publishToMavenLocal.

I am getting error

Execution failed for task ':generateMetadataFileForIosArm64Publication'.
> java.io.FileNotFoundException: /Users/vmodi/IdeaProjects/AndroidModule/build/classes/kotlin/iosArm64/main/klib/AndroidModule.klib (No such file or directory)

build.gradle.kts

plugins {
    kotlin("multiplatform") version "1.6.20"
    id("maven-publish")
}

group = "me.vmodcleari"
version = "1.0.0"

repositories {
    mavenCentral()
}

kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "1.8"
        }
        withJava()
        testRuns["test"].executionTask.configure {
            useJUnitPlatform()
        }
    }
    ios()

    sourceSets {
        val commonMain by getting
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val jvmMain by getting
        val jvmTest by getting
        val iosMain by getting
        val iosTest by getting
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source