Kotlin Error : Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7
Solution 1
replace
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
^
|
JRE = Java Runtime Environment
with
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
^
|
JDK = Java Development Kit
Since the version with jre is absolute , just replace and sync the project
Official Documentation here Thanks for the link @ ROMANARMY
Solution 2
In Project level build.gradle
use only this version
ext.kotlin_version = '1.3.31'
Remove other versions
This will only work with the latest version of android studio 3.4
UPDATE: Try to use the latest version of kotlin with latest Android studio to avoid an error.
Solution 3
The split of kotlin-stdlib
into kotlin-stdlib-jre7
and kotlin-stdlib-jre8
was only introduced with Kotlin 1.1, that's why the dependency cannot be resolved, the package version simply does not exist.
It looks like the update to your project files failed at some point and set the Kotlin version to 1.0.7. If this is a new project and there's nothing holding you back from using 1.1.1, I'd switch to that. Your problem should be gone after doing this.
Solution 4
If you hereafter removing Jcenter from Gradle then add this to your gradle
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
So main point is that, add mavenCentral()
and maven { url "https://jitpack.io" }
in gradle
Solution 5
In "build.gradle" file, change current Kotlin version that line and press synk:
ext.kotlin_version = '1.1.1'
/// That will look like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Mike6679
Updated on July 08, 2022Comments
-
Mike6679 almost 2 years
I installed the Kotlin plugin into my app (v. v1.1.1-release-Studio2.2-1) and then selected "Configure Kotlin in Project" I selected compiler and runtime version of 1.0.7. Kotlin updated my Gradle files. Now when I try to build in I get:
Error: A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugApkCopy'. Could not find org.jetbrains.kotlin:kotlin-stdlib-jre7:1.0.7. Required by:
MyApplication:app:unspecified
I'm not sure what I'm missing here.
-
Patel Pinkal over 7 yearsPost your project level
gradle
-
IgorGanapolsky over 6 yearsThis is how you add Kotlin support for Android: kotlinlang.org/docs/reference/using-gradle.html
-
-
Don Hatch over 6 yearsAn answer that specifies a magic version to use, without explanation, is not all that helpful and becomes even less helpful over time. Are you suggesting upgrading from a lower version? Or downgrading from a higher version because the higher version has a bug?
-
Don Hatch over 6 yearsThank you for explaining. Several answers say use 1.1.1 without explanation, which will make the answers rapidly become useless in the future.
-
Patel Pinkal over 6 years@DonHatch this answer was given in March for android studio 2.2 which was getting error mention above in the question. It is not for android studio 3.0 or above.
-
Nemo about 6 yearsYou could elaborate on how this improves Mihail Salari's answer, on which it seems to be based.
-
Roman over 5 yearsSome helpful information in the docs about jdk and jre.
-
Lou Morda over 5 years@0xalihn answer below has a correct solution without magic version number
-
Farid over 5 yearsI believe one day Android team will make things a little easier not much just a little or at least they will write major changes in changelog with bold instead of burying it deep into the website to be mined out :))
-
James Wang over 5 yearsIt took me a full minute of staring to see the difference between
jre
andjdk
—I must be getting old. -
Arbaz.in about 5 years@PatelPinkal can you update your answer for latest android studio version.
-
Patel Pinkal about 5 years@Arbaz.in try to install and use a new version of kotlin. May its help you. Also, note that your studio should be the latest version if you are using latest kotlin version.
-
Arbaz.in about 5 years@PatelPinkal Sure ill do same
-
Patel Pinkal about 5 yearsOk, If it's working then edit this post or provide your answer here. So, others can have solutions.
-
Arbaz.in about 5 yearsi updated answer as per latest version of Android studio
-
Patel Pinkal about 5 years@Arbaz.in I can't see any update in answer. Please post your answer in a comment
-
Hamed Zakery Miab over 2 yearswhich file should i search for this?
-
Alexandre G about 2 yearsThanks. Only needed
mavenCentral()
for me (to replacejcenter()
)