6

I'm trying to build my project using gradle but it seems that it can't find my kotlin plugin, even though I did add it using "install plugin from disk".

enter image description here

This is the error I'm getting:

Could not resolve all dependencies for configuration ':classpath'. Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-release-1038. Searched in the following locations: https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.0.0-release-1038/kotlin-gradle-plugin-1.0.0-release-1038.pom https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.0.0-release-1038/kotlin-gradle-plugin-1.0.0-release-1038.jar

Can anyone help me with this? I'd really like to build my project.

SJ19
  • 1,933
  • 6
  • 35
  • 68

2 Answers2

8

I can guess that you doesn't have repository in build.gradle, so please compare your build file with following, and then make "Gradle Refresh" in Idea.

buildscript {
  ext.kotlin_version = '<version to use>'
  repositories {
    mavenCentral()
    // or better:
    jcenter()
  }
  dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

apply plugin: "kotlin"

repositories {
  mavenCentral()
  // or better:
  jcenter()
}

dependencies {
  compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

Pay more attention to buildscript part of config: repositories here is necessary!

I got config from here, with my little refinements.

Ruslan
  • 14,229
  • 8
  • 49
  • 67
0

I'm having the same issue, as I try to switch my build files to Kotlin.

Or, rather, as I try to convert them from Kotlin that seems to cause my tools to have occasional nervous breakdowns to the sort of Kotlin that does not. I'm good at a lot of thing, but I'll take a nice, trustworthy GNU Make of gradle any day and twice on sundays, and gradle seems to feel the same way about me.

But it seemed to be working out well. I read this article, and all the red and pink and yellow was disappearing out of my build files, and then,a ll of a sudden the damned thing decided that it had never heard of the Android Plugin, and wouldn't put any faith in that sort of nonsense, even if it had.

Actually, first it forgot what a classpath was. Started telling me it had never heard the word,and didnt' appreciate that sort of language, anyway.

I know I heard something about not using the plugin block, but I don't know where.