Runtime JAR file has version 1.4 which is older than required for API version 1.5

今天打包一个项目,突然报个错,让人摸不到问题所在。这个项目是java开发的。

/Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.20/9be77b243a362b745e365f286627b8724337009c
/kotlin-stdlib-1.4.20.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5

w: Runtime JAR files in the classpath have the version 1.4, which is older than the API version 1.5.
Consider using the runtime of version 1.5, or pass '-api-version 1.4' explicitly to restrict
the available APIs to the runtime of version 1.4. You can also pass '-language-version 1.4' instead,
which will restrict not only the APIs to the specified version, but also the language features

看了提示,应该是jar包版本的问题。

但问题肯定出在:

kotlin-stdlib

哪应该如何解决呢?

应该是无意当中用到了kotlin写的包了,所以打包编译的时候,会用到这个依赖,但是没有指定,那只能用系统自带的,但是kotlin已经升级为最新版本。

1、增加classpath : build.gradle(project:xxxx)

 

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"

2、增加 dependencies: build.gradle(project:xxxx.app)

implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.10'

其中:xxxx您的项目名称。

 

以上二步基本上解决了上面的报错,如果还有报错,看一下提示,解决即可。

在这里,缺少布局中的一个属性没有,默认生成了不同设备的文件导致。

 

 将其它的v24,land,如果用不到,删除就可以解决。

 

posted @ 2021-12-22 18:29  jiduoduo  阅读(2241)  评论(1编辑  收藏  举报