解决<get-metadataDependencyResolutions>(...) must not be null的问题

前言

在使用Kotlin多平台的时候,发现gradle有时候会爆这个错误(但有时又正常):

[ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':beans:transformCommonMainDependenc
[ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > <get-metadataDependencyResolutions>(...) must not be null

直接搜<get-metadataDependencyResolutions>(...) must not be null在各种搜索引擎上都无法搜索到具体内容,后来搜了下transformCommonMainDependenc这个task,找到了一个相似的问题,试了下果然改好了

修改方式

可以每一条都试试

1.将gradle版本升级到7.5.1或以上

2.检查自己的依赖项,有没有哪个依赖没有声明版本号(显式或隐式)

3.在gradle.properties最后一行加上如下代码重新编译:

org.gradle.jvmargs=-Xmx2g -Duser.country=US -Duser.language=en

ps:有时候运行kmp desktop会提示找不到MainKt文件,其实可以直接通过gradle的run命令来运行,如果直接运行main函数,则gradle中配置的args也会无效

参考:

Distribution Path Returns Null · Issue #408 · rjaros/kvision (github.com)

猜你喜欢

转载自blog.csdn.net/qq_33505109/article/details/127964945