英文:
Could not found kotlinx-atomicfu Compose Multiplatform iOS
问题
我正在尝试构建我从JetBrains的 compose-multiplatform-ios-android-template 存储库克隆的项目。
代码在Android上运行良好,但在iOS上出现错误。我还尝试更新了cocoapods,但仍然出现错误。现在当我尝试在 Android Studio 上构建项目时,在我的logcat中出现以下错误。
在 org.jetbrains.kotlin.library.SingleFileResolveKt$resolveSingleFileKlib$1.fatal(SingleFileResolve.kt:21)
在 org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:171)
在 org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:176)
在 org.jetbrains.kotlin.library.CompilerSingleFileKlibResolveStrategy.resolve(SearchPathResolver.kt:298)
在 org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib(SingleFileResolve.kt:24)
在 org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib$default(SingleFileResolve.kt:15)
在 org.jetbrains.kotlin.cli.metadata.KlibMetadataDependencyContainer.<init>(K2MetadataKlibSerializer.kt:117)
在 org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer$serialize$analyzer$1.invoke(K2MetadataKlibSerializer.kt:49)
在 org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer$serialize$analyzer$1.invoke(K2MetadataKlibSerializer.kt:43)
在 org.jetbrains.kotlin.cli.metadata.CommonAnalysisKt.runCommonAnalysisForSerialization(CommonAnalysis.kt:42)
在 org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer.serialize(K2MetadataKlibSerializer.kt:48)
在 org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:122)
在 org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:40)
在 org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
在 org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
在 org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
在 org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1486)
在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
在 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
在 java.base/java.lang.reflect.Method.invoke(Unknown Source)
在 java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
在 java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
在 java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
在 java.base/java.security.AccessController.doPrivileged(Unknown Source)
在 java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
在 java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
在 java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
在 java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
在 java.base/java.security.AccessController.doPrivileged(Unknown Source)
在 java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
在 java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
在 java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
在 java.base/java.lang.Thread.run(Unknown Source)
错误已存储在 ../.gradle/kotlin/errors/errors-1686806929950.log
有没有解决方法?
我已经尝试了多次清理和重新构建,希望能够成功构建。但不幸的是,每次都失败了。
英文:
I am trying to build the project that I have cloned from the repository compose-multiplatform-ios-android-template of JetBrains.
The code was running fine on Android but throws an error on iOS. I also tried to update the cocoapods. Still, this gives an error. Now when I try to build the project on Android Studio this gives the below error on my logcat
java.lang.IllegalStateException: e: Could not find "../shared/build/kotlinTransformedMetadataLibraries/commonMain/org.jetbrains.kotlinx-atomicfu-0.17.3-nativeInterop-8G5yng.klib" in [/Users/rasel/Library/Application Support/kotlin/daemon]
at org.jetbrains.kotlin.library.SingleFileResolveKt$resolveSingleFileKlib$1.fatal(SingleFileResolve.kt:21)
at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:171)
at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:176)
at org.jetbrains.kotlin.library.CompilerSingleFileKlibResolveStrategy.resolve(SearchPathResolver.kt:298)
at org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib(SingleFileResolve.kt:24)
at org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib$default(SingleFileResolve.kt:15)
at org.jetbrains.kotlin.cli.metadata.KlibMetadataDependencyContainer.<init>(K2MetadataKlibSerializer.kt:117)
at org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer$serialize$analyzer$1.invoke(K2MetadataKlibSerializer.kt:49)
at org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer$serialize$analyzer$1.invoke(K2MetadataKlibSerializer.kt:43)
at org.jetbrains.kotlin.cli.metadata.CommonAnalysisKt.runCommonAnalysisForSerialization(CommonAnalysis.kt:42)
at org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer.serialize(K2MetadataKlibSerializer.kt:48)
at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:122)
at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:40)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1486)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Errors were stored into ../.gradle/kotlin/errors/errors-1686806929950.log
Is there any workaround for it?
I have tried cleaning and rebuilding multiple times and was expecting the build to success. But unfortunately it fails every time.
答案1
得分: 6
显然,这经常发生,你需要打开你的 build.gradle.kts
文件,作为暂时的解决方案,将以下内容添加到其中:
buildscript {
dependencies {
// 使用与错误中相同的版本
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.17.3")
}
}
allprojects {
apply(plugin = "kotlinx-atomicfu")
}
英文:
apparently this happens often, you will need to go to your build.gradle.kts
and add the following there as a workaround for the moment
buildscript {
dependencies {
// Use the same version in the error
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.17.3")
}
}
allprojects {
apply(plugin = "kotlinx-atomicfu")
}
答案2
得分: 0
我必须在共享模块的commonMain中添加以下依赖项(或者可以是任何给出指定错误的模块),以解决此错误,这个插件对我无效:
implementation("org.jetbrains.kotlinx:atomicfu:0.20.2")
英文:
I had to add following dependency in commonMain of shared module (or it could be any module giving the specified error) for this error to be solved, the plugin didn't work for me:
> implementation("org.jetbrains.kotlinx:atomicfu:0.20.2")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论