Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org.gradle.kotlin.kotlin-dsl was not found

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

like image 232
Charming Wong Avatar asked Nov 26 '19 07:11

Charming Wong


2 Answers

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.

like image 165
diemer Avatar answered Sep 20 '22 23:09

diemer


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.

like image 34
wonsuc Avatar answered Sep 18 '22 23:09

wonsuc