To downgrade the plugin, you need to uninstall it, download the 1.0. 6 version corresponding to your IDE version as a file from plugins.jetbrains.com and install it using the “Install plugin from disk” button. The lack of support for downgrading plugins is a limitation of the IntelliJ Platform at this time.
You can update your Kotlin version in your project level build.gradle
file. If you have it configured the usual way, you should have the following line in it around the top:
ext.kotlin_version = '1.1.2'
To upgrade to the version matching your plugin, simply change this line to:
ext.kotlin_version = '1.1.2-3'
Edit (to respond to a question below):
The error tells you that you need to upgrade your version, the question is where to find out that you have to put in 1.1.2-3
instead of saying, for example, 1.1.2-release-Studio2.3-3
.
The best way to find out the latest version of Kotlin is by going to kotlinlang.org and looking for "Latest version". Should be right there on the front page.
Another thing to do if the version number is non-trivial like this is to check the repositories where the versions are hosted. In the case of Android, you'll probably be getting it from jcenter, for which you can find the repository page, which has all the available versions listed.
You can also browse the raw maven repository of jcenter where the files are actually hosted by going here, or look up Kotlin either on mvnrepository or on mavencentral (raw version of the latter here).
In your (Project: [projectName])
build.gradle
file find this:
ext.kotlin_version = 'x.x.x'
and replace x.x.x with the current version of your Kotlin plugin.
In order to check which is the current version of your Kotlin plugin:
Go to: Tools -> Kotlin -> Confugure Kotlin Plugin Updates
Click "Check again". After a second you will see the version of your Kotlin plugin. (If not up to date, your Kotlin plugin will be updated.)
N.B.: Also check your (Module: app)
build.gradle
file and assure that you do not use:
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.21"
but
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.40'
Note the difference "...jre7..." -> "...jdk7...". Also replace "1.2.40" with your current Kotlin plugin version.
it complained (on Android Studio 3.0.1) ...most likely because of referenced libraries' dependencies:
Your version of Kotlin runtime in 'org.jetbrains.kotlin:kotlin-stdlib:1.1.3@jar' library is 1.1.3, while plugin version is 1.1.51-release-Studio3.0-1.
then I've enforced building against the version it demanded, in the module level build.gradle
:
configurations.all() {
resolutionStrategy.force 'org.jetbrains.kotlin:kotlin-stdlib:1.1.51'
}
and the result is:
./gradlew app:dependencies | grep kotlin
Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib/1.1.51/kotlin-stdlib-1.1.51.pom
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.1.3 -> 1.1.51
...
There are two pieces you may want to update:
The answer by Ivo Stoyanov shows how to do this using the android studio menus. When I got the error message and tried this (updating the kotlin plugin) alone, it still complained about the kotlin runtime. You can update that on a project by project basis, by adding the line on ext.kotlin_version to the project build gradle, as some of the other answers indicate. But you'll need to know the kotlin runtime version for that. Alternatively, you can also do it through the menus, as I show here below, with the bonus that android studio shows you the available versions, and you can pick the most recent.
And then android studio will add in the appropriate line in your project build gradle.
changing your ext.kotlin_version from '1.1.2-4'to ext.kotlin_version = '1.1.2-5' solved the problem for me
the latest version of kotlin is 1.2.41 use this and syn your project.
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
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
}
}
As of March 8, 2019 the current kotlin version is '1.3.21'
Under build.gradle
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
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
}
cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With