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

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

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.

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.
Download KeyStore Explorer and install it on your system. (In my case Windows10 OS)
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.
On the toolbar, go to Examine -> Examine SSL, insert these values and click OK.
SSL Host: plugins.gradle.org
SSL Port: 443
Click the Import button and OK.
Save the file, and go to Android Studio, run Invalidate Caches / Restart.
If Android Studio is reopened, try Sync Project with Gradle Files again.
Please leave a comment, if you have more questions.

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"

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.

Related

After update classpath 3.5.0. to 3.5.1

Upgrade Gradle build tools to the latest version then this issue occurs. Could not resolve all artifacts for configuration ': classpath'.
Could not resolve com.android.tools.build:gradle:3.5.1.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.5.1.
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.pom'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.pom'.
Remote host closed connection during handshake
Here is the possible reason,
1) Check your internet connection, if it works then,
2) Check that your firewall, because if some of the Google Service blocks at that time also you get an exception.
3) Invalid cache and restart Android Studio.
Hops this helps.
Try this in Android Studio
Settings -> Build -> Gradle -> Android Studio -> Enable embedded maven repository
In app level gradle file, add following
repositories {
google()
jcenter()
}
I was able to solved this error in our school where we used network "proxy" settings. The error is always [Could not resolve all artifacts for configuration ':classpath'.] from old version of Android Studio SDK even the new one 3.6.1. Below are the steps I made and hope it will be of great help to you guys:
1. Check your Network Settings -> Proxy -> Use a Proxy Server (TURN IT OFF)
2. Check Control Panel\Network and Internet\Network Connections -> Ethernet Properties -> IPV4 Properties -> Change to obtained (or you set it with your common network IP)
3. Open the file gradle.properties location C:\Users\.gradle\ and remove all the settings related to "proxy" which makes the Android error in classpath.
Thats it.

Android Studio : Gradle failed to resolve Dependencies

I recently migrated an eclipse project to androidStudio. But while building AS failed to resolve the dependencies. Initially I thought it might be the proxy problem as I am in the restricted network, So I added the proxy settings resulting nothing.
So I tried gradlew in terminal and the output of is as below :
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.3.2.
Required by:
project :
Could not resolve com.android.tools.build:gradle:2.3.2.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.pom'.
This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server
So I tried reaching "https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.2/gradle-2.3.2.pom" from my browser and it browser downloaded file successfully. That means network if fine.
So why AS studio is failing to solve dependencies?
Is there something wrong with the gradle version?
How do I decide which gradle version suits my Project?
Appreciate your responses.
Try :
First :
repositories {
jcenter({url "http://jcenter.bintray.com/"})
}
If that does not work.Gradle to manually sync proxy
gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8580

Peer not authenticated in AndroidStudio, but not on commandline-gradle

When building my project in AndroidStudio I regularly get the error
08:53:33.788 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
It happens whenever the local gradle cache is invalidated, so around once a day. When I build it from the commandline, either with gradle or ./gradlew, it works and the artifacts are downloaded.
The project uses a private maven repository for downloading dependencies. It was a bit tricky to set up and probably is part of the problem. Authentication works via a client certificate that is specified in a bash variable:
GRADLE_OPTS=-Djavax.net.ssl.keyStore=client_certificate.p12 -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.keyStoreType=PKCS12 -Djavax.net.ssl.trustStore=truststore.jks -Djavax.net.ssl.trustStorePassword=changeit
It is exported in my ~/.profile script. When this variable is not set, also the commandline build will fail with a "peer not authenticated" error.
What I tried already with no success:
Set GRADLE_OPTS in "Compiler/Command-line Options" with -P
Set GRADLE_OPTS in "Path Variables"
Import the server certificate to jdk/Contents/Home/jre/lib/security
Use the latest Java version for compiling
How can the AndroidStudio build be fixed?

Android Studio installation doesn't work with gradle

I am absolute beginner with Android Studio (especially Gradle) and having big trouble getting Android Studio to work. I downloaded and installed the most recent version of Android Studio (0.8.0). I have set the JDK_HOME variable. However, after I create a new project, I always receive the following message:
Error:Unknown host 'jcenter.bintray.com'.
Enable Gradle 'offline mode' and sync project.
Learn about configuring HTTP proxies in Gradle
If I try to compile the project, I get the following message dialog:
After reading a post, I manually downloaded the Gradle binaries (latest, 2.0), extracted it onto the local drive, went to Settings and set the Gradle path to the respective directory using the following:
I also tweaked the build.gradle file under the project to point to the latest Gradle 2.0 version. However, now I get the following error message:
Error:A problem occurred configuring root project 'HelloAndroidStudio'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.0.+.
Required by:
:HelloAndroidStudio:unspecified
Failed to list versions for com.android.tools.build:gradle.
Unable to load Maven meta-data from http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
jcenter.bintray.com
Please can someone help. Being my first time with Gradle, I have been trying for so many days without any clue to the problem. Thanks.
Change the Gradle version to lower ones and restart the Android Studio, you may get it.
Add this in build.gradle
classpath 'com.android.tools.build:gradle:1.1.0'
Setting the http_proxy under appearance & behaviour -> system settings -> http proxy has solved the problem
Change to the latest classpath in the dependencies.
For AS 1.5.1 I will do like this :
buildscript {
repositories {
jcenter()
}
dependencies {
**classpath 'com.android.tools.build:gradle:1.5.0'**
}
}

Uploading file local path: XXX remote path: XXX I/O Error: EOF

On Android Studio 0.4.4, getting this error, even found this error in previous version too!
Uploading file local path:XXX/XXX.apk
remote path:/data/tmp/XXXX
I/O Error: EOF
"Sync Project with Gradle Files" should solve the problem.
Tools -> Android -> Sync Project with Gradle Files
The reason these errors tend to come up is because the Gradle file becomes out of sync. The way that I have seen in the past to solve this is to clean the project, confirm that the gradle properties is set to the correct version (which would be 0.6.+ atm), and then click the Gradle Sync button in the toolbar.

Categories

Resources