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.
I downloaded Android Studio 3.0 and I started following along building my first app tutorial. But Gradle threw errors like:
Could not resolve com.android.support:appcompat-v7:26.1.0.
I searched on SO for similar problems like this and that, but none of them helps me.
Eventually I figured out that I'm using a proxy for Android Studio:
To resolve the error, I have to implement the proxy for Gradle too, by adding these lines to gradle.properties file:
systemProp.http.proxyHost=127.0.0.1
systemProp.http.nonProxyHosts=localhost, 127.0.0.1
org.gradle.jvmargs=-Xmx1536m
systemProp.http.proxyPort=8118
systemProp.https.proxyHost=127.0.0.1
systemProp.https.nonProxyHosts=localhost, 127.0.0.1
systemProp.https.proxyPort=8118
After adding the above statements to gradle.properties, the error got resolved. Note that both HTTP and HTTPS proxies need to be added to Gradle properties
I had the same error. Tried a lot of stackoverflow links but none of them helped until this one. The problem in my case was due to https proxy settings which were not there in the gradle.properties file. I included it and it worked.
For android studio 3, inside build.gradle file of your project you have this:
allprojects {
repositories {
jcenter()
google()
}
}
The jcenter() runs over https and hence if you are building in a network(in most cases company network) which uses https proxy, and you forgot to include it in your gradle.properties file, then you are likely to face the issue. You may feel that gradle is behaving weird but its not. Its only missing the proper network configuration. Even offline build settings wont work since it still needs jcenter() to download files for the first time you are building an app in latest Android Studio.
I included my https proxy settings in gradle.properties like this:
systemProp.https.proxyHost=<proxy server address>
systemProp.https.nonProxyHosts=localhost, 127.0.0.1
systemProp.https.proxyPort=<port number>
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
I've just updated to Android Studio 1.3, opened an existing project I was working on, tried to run it. Gradle just gets stuck at the "Resolve dependencies':app_debugCompile'", I tried to wait, I waited for over an hour and nothing happened.
How can I solve it to get my app running?
If you are using proxy, it seems https proxy server setting is not correctly done in Android studio 1.3.
You can set https proxy server manually in gradle.properties,
systemProp.https.proxyHost=proxy.server.address
systemProp.https.proxyPort=8080
see Gradle Sync fails in Android studio 1.3 and gradle behind proxy in Android Studio 1.3.
How can I solve it to get my app running?
Start by identifying the problem more precisely. To do so, run gradle from the command line in the root directory of your project :
./gradlew --debug clean build
The --debug argument will simply enable the debug log level and hopefully providing useful information to understand where/why it is hanging.
I face this problem in linux and my problem solved after installing these dependencies on fedora :
sudo dnf install glibc.i686 zlib.i686 libstdc++-devel.i686
I had this problem.Just see this page. Solution is here
Solution :
Make sure you have latest stable version ( current 2.0.0 )
Make sure your gradle version is 2.0.0 in build.gradle ( classpath 'com.android.tools.build:gradle:2.0.0')
Final step and most important one is change your jcenter() to mavenCentral()
So you can easily add new dependency and sync project under 3sec !
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Go to app > Right Click on it > Open Module Settings>Change build tool version to 22.0.1
Try again after restarting your Android Studio
I've just encountered this issue in the OP, in my case it was taking over 20min just to get gradle build going. Getting stuck at the "Resolve dependencies':app_debugCompile'" as well.
I'm still relatively new to Stackoverflow so I can't up-vote yet. But what I can tell you is that if your behind a web proxy like I am and you've just updated to Android 1.3.1 you will probably notice this issue immediately. I already had my companies web proxy in the IDE settngs and yes there is something not ok with the 1.3.1 update. As corochann posted you have to add the proxy info to the gradle.properties of your project. Once I actually did this I noticed the difference immediately. Going forward until its resolved you'll probably have to add this to each project if your behind a web proxy and running 1.3.1. I have another machine at home that isn't behind a proxy and is running Android Studio version before 1.3.0 and had no issues. Hope this helps!!
I have already created one project and gradle sync worked successfully.
When I try to create another project it fails and gives the error message that
Gradle '<ProjectName>' project refresh failed
Error:Cause: peer not authenticated.
I have setup SDK, gradle gave gradle VM options
-Dhttp.proxyHost=<proxy.address> -Dhttp.proxyPort=<port> -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password>
And in HTTP proxy tab also I have given the correct options.
Can anyone help me?
This was the solution that worked for me. Posting here in case it helps someone.
Gradle version was not correct in project build.gradle file.
I had
classpath 'com.android.tools.build:gradle:1.0.0'
but this needed to be
classpath 'com.android.tools.build:gradle:2.1.0'
Note:
This should be updated to the newest version of gradle tools which can be found here
Android Studio also recommends the latest plugin version.
DO NOT change your package source to http instead of https. Stop using these workarounds and fix the root cause.
Do you want to have a driveby exploit in your app? Because that's how you get a driveby exploit in your app!
The source of this problem Certificate Authority keystore. Somehow dpkg seems to try to build the Java keystore (/etc/ssl/certs/java/cacerts) before it actually installs Java, which the the tool to build the store requires. The result is an empty store:
To fix this, properly build the keystore with all trusted CA certificates.
Run this with sudo:
sudo rm /etc/ssl/certs/java/cacerts
sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure
You should see a long list of added certificates (*.pem) and finally a “done”.
Re-sync the project using gradle, and all will download. Don't forget to turn off the http override if you've set it!
Source: https://justus.berlin/2015/01/connection-problems-with-ssltls-peers-in-java-on-ubuntu-server-14-12-with-fix/
This error says that you're trying to connect using HTTPS protocol, but your client unable to validate server's certificate - usually because it is self signed.
Connect to https://jcenter.bintray.com with your browser, and check the certificate chain. The root certificate should be issued by GeoTrust Global CA. If it's not the case, your Internet Provider or your employer perform MITM to your HTTPS connections.
If you trust them, the simple workaround will be to add those self-signed certificates into JDK's cacerts keystore. Examples for how to do that: Windows; Linux/Mac.
Usually this error happens when you're under a company proxy. My solution on MAC was this:
Identify the Certificate is being used by your https connections
Open Key Chain Tools (cmd+space key chain)
Identify the certificate found up and export it to certificate.cer file
Open the terminal and navigate to your JAVA JRE security folder:
cd /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/security
Import the certificate with the following command:
sudo keytool -import -alias somealias -file /PATH_TO_EXPORTED_CERTIFICATE/certificate.cer -keystore cacerts -storepass changeit
That is done. Open Android Studio and it will fix the gradle build.
It's a dumb answer, but what fixed this for me was restarting Android Studio.
I was using Charles Proxy off and on, I suspect that had something to do with the cause of the error. Closed the proxy and restarted android studio, and it worked. Figured I would post because sometimes the answer is so simple we forget to even try it.
I closed my studio and when I re-opened the project, I got a window to enter proxy information. In that, I had to check the check box which said "Enable HTTPS proxy" and that worked for me!
please change the gradle build tools version first. You need to update the build tools version. Still not working, create a new project and check the gradle file details. 1.5.0 is the latest version I have installed.
classpath 'com.android.tools.build:gradle:1.5.0'
After meddling with it, and following Schizo's answer (you should follow it also), and it not working. I realized Android Studio was using java-7-openjdk but I added a certificate to java-8-openjdk, so it didn't work until I changed it to the openJDK 8 in Project Structure, so be sure that you check that also, in case it's not working for you.
THis fixed it for me after wasting lot of time trying various solutions:
Check the dependencies -> classpath in build.gradle file of project
dependencies {
classpath 'com.android.tools.build:gradle:2.10'
}
Changed this to classpath 'com.android.tools.build:gradle:2.0.0-rc1 in my case to fix the issue . To know the correct version to be used, made a new project and checked the build.gradle file .
Hope this helps.
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
}
I change classpath com.android.tools.build:gradle:1.1.3' to com.android.tools.build:gradle:1.0.0
There is one more small change can help you in
gradle-wrapper.properties
Change
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
To
distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip
Sync the project once you did the change
I also faced the same issue and the problem was related to certificates.
1: So first step is go to Build-> Clean Project. It will give you the details about the error.
2: Copy URL which is failing from the stack-trace. For eg build is failed to download some file, stack-trace will have the information of the URL.
3: Open the url in a browser, if you are able to open it that means your proxy settings are fine but java is unable to trust the source to download it.
4: So you need to copy the certificate manually and put in the jre certificates. And rebuild should resolve the problem.
5: Or if you have the latest jre verison, it might solve the problem.
As this occurs I using Ubuntu: When I changed version on android studio 2.0 9 preview beta 1.
How do I fix my gradle.
Simply created a new project in android studio and then went in and saw build.grandle version gradle in my case:
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta1'
}
and replace in my project.
I hope it helps others.
In my case I had to download the latest Java SDK and then change the JDK location in the project to the downloaded JDK. Apparently something was wrong with the current JDK (had some warning from my virus scanner about this)
In case this helps someone, I had the same issue and even though I set the proxy through the studio settings ( which adds the values of systemProp.http.proxyHost and systemProp.http.proxyHost to gradle.properties), https proxy was not set, so I added this in gradle.properties
systemProp.https.proxyHost = <your proxy host>
systemProp.https.proxyPort = <your proxy port>
and problem solved!
answer share from here https://stackoverflow.com/a/37962441/4030497
in case when there are some problems with internet,
try to add a line
54.231.14.232 s3.amazonaws.com
to your /etc/hosts (..\Windows\System32\drivers\etc\hosts)
Make sure you have specified latest gradle version in build.gradle file and latest distributionUrl in gradle-wrapper.properties file. Check network connetivity is proper or not [ Network connection should be without firewall/other settings which can stop upgrading gradle]
distributionUrl=http://services.gradle.org/distributions/gradle-2.1-all.zip
keep the http://
I have the same problem and salve it,My conduction is I define the HTTP proxy and I use agent to connect the server. Actually, you don't need proxy to connect jcenter
Changing my build.gradle to shown below worked.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Update your gradle to the latest version .
It works perfectly .
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
I hope it helps.
May be sometimes your app use Crashlytic bundle in your graddle
And your network cannot resolve Crashlytic library. In another way, may be others lib can cause problem. Please check your internet can access and grep those libs.
So it return an error that
"Error:Cause: peer not authenticated."
For me, I solve this problem by comment code that evolved crashlytics lib all
and compile again ---> this problem drain my working time to 4 hrs to know and clear it.
T ^ T
Wish all of us safe from this problem.