0

我正在尝试导入我的 ios 框架,从那里我得到这个错误:

fatal error: could not build module 'FRAMEWORK_IOS'

我还成功导入了其他第三方框架,例如:mapbox 和 firebase 框架。

总的来说,我得到的这个错误不是很清楚,我无法找到导致问题的原因,因为如果我直接从 xcode 加载该自定义框架,它将按预期工作。

毕业典礼:

ios {
val frameworkLocation = File("/Users/user/Desktop/MyProject/shared/src/iosArm64Main/SDK")
val frameworks = "-F$frameworkLocation"
compilations {
    @Suppress("UNUSED_VARIABLE")
    val main by getting {
        cinterops {
            val FRAMEWORK_IOS by creating {
                defFile = File("/Users/user/Desktop/MyProject/shared/src/nativeInterop/cinterop/FRAMEWORK_IOS.def")
                compilerOpts(frameworks)
            }
        }
    }
}
binaries.matching { it is org.jetbrains.kotlin.gradle.plugin.mpp.Framework }
    .configureEach {
        val framework = this as org.jetbrains.kotlin.gradle.plugin.mpp.Framework
        framework.linkerOpts(frameworks)
    }
}

定义

language = Objective-C
modules = FRAMEWORK_IOS
linkerOpts = -framework FRAMEWORK_IOS

错误:

Exception in thread "main" java.lang.Error: /var/folders/ll/7t94x_gn5nz24xb1f1v_02q40000gr/T/7671724635539436126.m:1:9: fatal error: could not build module 'FRAMEWORK_IOS'
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesASTFiles(ModuleSupport.kt:68)
at org.jetbrains.kotlin.native.interop.indexer.ModuleSupportKt.getModulesInfo(ModuleSupport.kt:14)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.buildNativeLibrary(main.kt:515)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:266)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:76)
at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:38)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:60)

  FAILURE: Build failed with an exception.

  * What went wrong:
  Execution failed for task ':shared:cinteropFRAMEWORK_IOSIosArm64'.
  > Process 'command '/Applications/Android 
  Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full 
insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task 
':shared:cinteropFRAMEWORK_IOSIosArm64'.
4

0 回答 0