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

Eduard Mayer

12/11/2020, 2:41 PM
Hey there, i got a problem when embedding bitcode to our kotlin mpp library. As soon as i add
Copy code
ios {
  binaries {
    framework {
      embedBitcode("bitcode")
    }
  }
}
to my build.gradle.kts, i get the following error:
Copy code
* Where:
Build file '/Users/me/projects/shared-sdk/build.gradle.kts' line: 73

* What went wrong:
Cannot create binary debugFramework: binary with such a name already exists
which points exactly to the above snippet. Did anybody encounter the same? As soon as i remove it, it works, but i can't archive the ios app to throw it at AppStore Connect, because the bitcode is missing. The full
build.gradle.kts
and error log is attached here at this gist: https://gist.github.com/vsxed/3987c535cf98160a7a48b852fb9e4c64
a

Artyom Degtyarev [JB]

12/11/2020, 2:55 PM
Usually, when the
cocoapods{…}
block is being used, there is no need in specifying ios target explicitly(see in the documentation). To enable the bitcode setting at the
cocoapods{}
block, one should write something like
Copy code
cocoapods {
    summary = "BeCoachShared"
    homepage = "<https://becoach.app/>"
  }
  // When using cocoapods plugin we can't configure the Framework directly.
  targets.ios.binaries
      .findAll { it instanceof org.jetbrains.kotlin.gradle.plugin.mpp.Framework }
      .each {
        it.embedBitcode("YES".equals(System.getenv("ENABLE_BITCODE")) ? "bitcode" : "marker")
        
      }
I’m referring on this issue.
💯 1
🙌 1
e

Eduard Mayer

12/11/2020, 10:10 PM
Thanks so far. the cocoapods plugin seemed to be indeed the issue. removed it including the cocoapods block and now its building.
26 Views