org.gradle.kotlin.kotlin-dsl was not found
Asked Answered
T

5

10

I am getting the following error while running the build

FAILURE: Build failed with an exception.

* Where:
Build file '/home/charming/mainframer/bigovlog_android/buildSrc/build.gradle.kts' line: 4

* What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '1.2.6'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:1.2.6')
  Searched in the following repositories:
    Gradle Central Plugin Repository

my buildSrc/build.gradle.kts

repositories {
    jcenter()
}
plugins {
    `kotlin-dsl`
    id("groovy")
}
dependencies{
    gradleApi()
    localGroovy()
}

I tried everything but still not working

Taffeta answered 26/11, 2019 at 7:59 Comment(2)
Do you happen to have any proxy settings defined?Delouse
If so, in my case the issue was that I accidentally included the user / password into the systemProp.http.proxyHost URL instead of splitting them out into the systemProp.http.proxyUser and systemProp.http.proxyPassword properties.Delouse
S
16

Did you check that Android Studio wasn't running in Offline Mode? Take a look at Preferences/Build, Execution, Deployment/Gradle/Global Gradle settings and see if Offline Work is checked.

Shauna answered 17/2, 2020 at 16:42 Comment(0)
I
7

In my case, my company is using a proxy behind the network.

So it must be an SSL handshake fail issue.

To fix this issue, I use KeyStore Explorer.

Follow these steps.

  1. Download KeyStore Explorer and install it on your system. (In my case Windows10 OS)

  2. Run KeyStore Explorer and open the cacerts file, if you are using Android Studio on Windows 10, it's here: C:\Program Files\Android\Android Studio(or Preview)\jre\jre\lib\security with password changeit.

  3. On the toolbar, go to Examine -> Examine SSL, insert these values and click OK.

    SSL Host: plugins.gradle.org
    SSL Port: 443

  4. Click the Import button and OK.

  5. Save the file, and go to Android Studio, run Invalidate Caches / Restart.

  6. If Android Studio is reopened, try Sync Project with Gradle Files again.

Please leave a comment, if you have more questions.

Inequitable answered 6/7, 2020 at 6:31 Comment(1)
I had to switch off ZScaler internet securityCausey
E
2

I was updating my gradle to 8.2. After facing this problem I just added gradlePluginPortal() into my repositories. This solved the problem.

Eudora answered 5/2, 2024 at 19:37 Comment(0)
R
1

The same exact build file works for me. Try clean Gradle cache in both your project and home directory and check if it will work then. If it will still fail, try to update Gradle and the plugin to the latest version id("org.gradle.kotlin.kotlin-dsl") version "1.3.2"

Raymond answered 26/11, 2019 at 9:12 Comment(3)
How to clean Gradle cache?Inequitable
Remove .gradle folder in project directory and in your user's home directory.Raymond
This is the correct answer!! Try to find the latest version of the 'kotlin-dsl' plugin, and use it in either of (groovy or kotlin) build scripts.Birdlime
M
1

I have the same problem and I try gradle --info
the log is below:

Evaluating project ':buildSrc' using build file '/Users/fjh1997/mirai/buildSrc/build.gradle.kts'.
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond
Retrying request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond
Retrying request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond

It seems that pass requests to proxy 127.0.0.1:1083.However what url I set proxy in local gradle.properties file is 127.0.0.1:8118.What's wrong with that?After long time's efforts,I find it out.
Actually,there are two gradle.properties configuration files in your system , one is in your project/.gradle,another is in ~/.gradle.And the latter is the global setting for gradle.
If the global setting has set variables for systemProp.http.proxyHost, then whatever you set in project/.gradle/gradle.properties, proxy dosen't work at all,you have to change it in the global setting.
And BTW,I find that the global setting for gradle is changed by my android studio preference.

Moreover answered 16/6, 2020 at 15:10 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.