向 Kotlin Multiplatform 添加 pod 依赖会导致编译错误(非零退出代码 1)

问题描述 投票:0回答:1

在我的 kotlin 多平台移动项目中使用 pod 依赖项(在我的例子中是 lottie-ios)会导致它根本无法编译,并出现以下错误:

Failed to generate cinterop for :shared:cinteropLottie-iosIosArm64: Process 'command '/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java'' finished with non-zero exit value 1

这是我的 cocoapods 块:

cocoapods {
        summary = "Common Code (Platform-agnostic)"
        homepage = "."
        version = "1.0.0"
        ios.deploymentTarget = "14.1"
        podfile = project.file("../iosApp/Podfile")
        framework {
            baseName = "shared"
        }

        pod("lottie-ios") {
            version = "4.3.3"
        }
    }
android-studio cocoapods kotlin-multiplatform
1个回答
0
投票

基于这个ticket解决方案,我需要更改我的pod依赖块以确保模块名称与我将模块导入到Swift文件时相同,这就是结果:

 pod("lottie-ios") {
    moduleName = "Lottie" //The module name is the same as when you do "import" in a swift file (import Lottie)
    version = "4.3.3"
}

如果我使用任何其他模块名称,它将无法编译。

© www.soinside.com 2019 - 2024. All rights reserved.