How to resolve error “Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jre7…” when building in Android Studio Ask Question
//implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
I've created a new project by checking the "include kotlin" box in Android Studio 3 and out of the box I get an error while compiling
"Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jre7..."
I have made sure all plugins are up to date and that the Android SDK is properly installed.
Would anyone know how to solve for this error?
kotlin-stdlib-jre[7/8] was deprecated a while ago, and has since been removed. The deprecation note was kept until 1.2.71, which was the last version to release those artifacts. The official deprecation notice can be found here. Using any of the deprecated versions (before it was removed) should also produce a warning in (at least) Android Studio and IntelliJ.
Use kotlin-stdlib-jdk7 instead. It's the same dependency as kotlin-stdlib-jre7 (except newer), but it was re-named to kotlin-stdlib-jdk. kotlin-stdlib-jre is now no longer maintained as a separate dependency.
Both IntelliJ and Android Studio currently generate new projects using kotlin-stdlib-jre7; this likely is a bug. They have probably not updated the project generators. Therefore, you have to manually replace the dependencies with working ones until they fix this. This is dependent on the Kotlin plugin. Update it if you haven't. I haven't checked whether it's been patched or not - if it has, that only fixes the creation of new projects. For updating from older versions, the rest of the answer still applies
You naturally have to do this if you're on 1.2.71 or lower, and you're upgrading to 1.3.0 or higher.
These are the new valid dependencies as of Kotlin 1.3.0:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
Where $kotlinVersion is either a variable containing the version, or a hard-coded version (i.e. 1.3.0)
Alternatively, you can use the "plain" stdlib (kotlin-stdlib) instead of the JDK-specific versions. But you have to change your dependency either way, so I recommend you go with kotlin-stdlib-jdk7, or if you plan on using Java 8, kotlin-stdlib-jdk8
The newest versions of the dependencies can also be found here. jdk7, jdk8, and the version-unspecific stdlib all follow the same versions (as per this edit - this could change in the future, but there'll likely be notices before that change happens), so whether you check jdk8, jdk7 or the regular one, all the versions should be universally available across the stdlib artifacts.
Note for other build systems
The same actual solution applies to other build systems as well, but the code is different. As there are a lot of build systems, I'm not going to include all of them, but the point is changing the artifact from kotlin-stdlib-jre[num] to kotlin-stdlib-jdk[num] (without brackets of course). Or, as mentioned earlier, kotlin-stdlib.
Independently of the build system, this bases itself on access to Maven Central and similar repositories. If your build system doesn't support this, and/or breaks with Maven-style conventions and repositories, you'll have to find what works for your build system.
TL;DR:
Use org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version or org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version (depending on which version you originally used) instead.

Remove this line from the build.gradle:
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
Add this line in the build.gradle:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
Update the version build.gradle in project level: kotlin version='1.3.0'
In build.gradle (Module:app) replace
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
with
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
and in build.gradle (Module:project) change version to
ext.kotlin_version = '1.3.0'
In general cases, check for available artifacts at
https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jdk7https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jre7https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jdk8https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib-jre8
protected by Zoe the transgirl Jul 18 at 18:27
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Not the answer you're looking for? Browse other questions tagged kotlin or ask your own question.
- Product Manager at Forward Thinking Remote CompanySuperformulaNo office location$140K - $175KREMOTE
- Senior Android Software EngineerLalamoveKowloon, Hong Kong$45K - $90KRELOCATIONVISA SPONSORSHIP
Linked
Related
How to resolve error “Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jre7…” when building in Android Studio Ask Question的更多相关文章
- Error:Failed to resolve: com.afollestad:material-dialogs:
http://www.chenruixuan.com/archives/1068.html 背景: 同事把Android项目直接考给了我...我在Android Studio上运行,然后提示: Err ...
- Android Error:Failed to resolve: com.afollestad:material-dialogs:
背景: 同事把Android项目直接考给了我...我在Android Studio上运行,然后提示: Error:Failed to resolve: com.afollestad:material- ...
- Error:Failed to resolve: com.android.support:support-annotations:26.0.2
异常信息记录: Error:Failed to resolve: com.android.support:support-annotations:26.0.2 <a href="ins ...
- (转)Android Studio Error:Failed to resolve: com.android.support:appcompat-v7:25.1.0解决方案
今天不知道为什么导入eclipse项目后就出现了错误,没导入之前是正常使用AS的 Error:(26, 13) Failed to resolve: com.android.support:appco ...
- Error:Failed to resolve: com.android.support:recyclerview-v7:28.0.0解决方法
在使用Android Studio的过程中需要添加依赖recyclerview,出现报错: Unable to resolve dependency for ':app@debug/compileCl ...
- AndroidStudio — Error:Failed to resolve: junit:junit:4.12错误解决
原博客:http://blog.csdn.net/u013443865/article/details/50243193 最近使用AndroidStudio出现以下问题: 解决:打开app下的buil ...
- Error:Failed to resolve: com.android.support.constraint:constraint-layout:1.0.2
可以换个maven库: allprojects { repositories { jcenter() //maven { url "https://jitpack.io" } ma ...
- Error:Failed to resolve: com.android.support:appcompat-v7
repositories { maven { url "https://maven.google.com" } } implementation 'com.android.supp ...
- Error:Failed to resolve: :Base:
这个问题是变通了一下,原来是: //implementation(name: "Base", ext: "aar") 修改成: implementation f ...
随机推荐
- C#中Func与Action的理解
Action 与 Func是.NET类库中增加的内置委托,以便更加简洁方便的使用委托.最初使用委托时,均需要先定义委托类型,然后定义一个符合委托类型签名的函数,在调用前,需声明并创建委托对象,将指定函 ...
- SpringCloud Erueka配置异常
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known serve ...
- P1455 搭配购买 (并查集+01背包)
[题目描述] 明天就是母亲节了,电脑组的小朋友们在忙碌的课业之余挖空心思想着该送什么礼物来表达自己的心意呢?听说在某个网站上有卖云朵的,小朋友们决定一同前往去看看这种神奇的商品,这个店里有n朵云,云朵 ...
- 实现类似add(1)(2)(3)结果为6的效果
前两天看到一个问题说怎样实现add方法实现add(1)(2)(3)结果为6,于是开始引发了我的思考. 1.想要实现add()()这样调用方式,add()方法的返回值务必是一个函数 function a ...
- 如何在springboot中读取自己创建的.properties配置的值
在实体类里面加上 @PropertySource("classpath:/robot_config.properties") robot_config.properties // ...
- Python之路-初识python及环境搭建与测试(Python安装、Anaconda安装、PyCharm安装)
一.认识Python 起源 Python的作者是著名的“龟叔”Guido van Rossum,他希望有一种语言,这种语言能够像C语言那样,能够全面调用计算机的功能接口,又可以像shell那样,可以轻 ...
- 信号量Semaphore实现原理
Semaphore用于管理信号量,在并发编程中,可以控制返访问同步代码的线程数量.Semaphore在实例化时传入一个int值,也就是指明信号数量.主要方法有两个:acquire()和release( ...
- day02-css
技术分析 HTML的块标签: div标签: 默认占一行,自动换行 span标签: 内容显示在同一行 CSS概述: Cascading Style Sheets : 层叠样式表 主要用作用: 用来美化我 ...
- 2018-2-13-win10-uwp-参考
title author date CreateTime categories win10 uwp 参考 lindexi 2018-2-13 17:23:3 +0800 2018-2-13 17:23 ...
- python时间测量
使用自定义装饰器测量时间 def test_time(func): def inner(*args, **kw): t1 = datetime.datetime.now() print('开始时间:' ...



