下载了别人的一个项目,项目编译完成没有出错,运行时出现如下错误
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.3.20.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.3.20/kotlin-stdlib-jre7-1.3.20.pom
- https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.3.20/kotlin-stdlib-jre7-1.3.20.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jre7/1.3.20/kotlin-stdlib-jre7-1.3.20.pom
Required by:
project :app
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
百度看了下基本都是说导入三个依赖:‘google()’、‘jcenter()’、‘maven()’。但是试了一下没什么用,最后给出解决方案:
在引用kotlin-stdlib-jre7的module的gradle.build文件中修改:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.3.20"
改成
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.20"
引用的末端低版本的是jre7,高版本的是jdk7