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
Related
I have raised this as an issue with Appodeal, but could do with some help in the meantime as I really need a fix: (https://github.com/appodeal/react-native-appodeal/issues/101)
I recently updated react-native-appodeal to 3.0.2, and iOS is working perfectly, however when I try to build for android i get the following error:
* What went wrong:
Could not determine the dependencies of task ':app:dexBuilderProdRelease'.
> Could not resolve all task dependencies for configuration ':app:prodReleaseCompileClasspath'.
> Could not resolve com.facebook.soloader:soloader:0.9.0+.
Required by:
project :app
> Failed to list versions for com.facebook.soloader:soloader.
> Unable to load Maven meta-data from https://artifactory.appodeal.com/appodeal/com/facebook/soloader/soloader/maven-metadata.xml.
> Could not GET 'https://artifactory.appodeal.com/appodeal/com/facebook/soloader/soloader/maven-metadata.xml'. Received status code 401 from server: Unauthorized
I have tried a few things, such as patching the lib to remove jCenter() but so far I have had no success, but this artefact is hosted on their own subdomain so I don't think that makes a difference??
If I navigate directly to https://artifactory.appodeal.com/appodeal/com/facebook/soloader/soloader/maven-metadata.xml, I am faced with a sign in request.
Am i right in thinking this is most likely a config error at their end, or is there something simple I am missing that could bypass this?
Thanks in advance!
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 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'**
}
}
Using the new project wizard to create a new Android application, The IDE gets stuck before I can even see the Code files. After trying to create many types of projects, It tells me that it is building and the IDE only shows a Loading box that says either:
Gradle: Configure Project
or
Gradle: Resolve Dependencies ':classpath:'
I went out to lunch and when I came back I saw:
Error:Could not HEAD 'http://jcenter.bintray.com/com/android/tools/build/builder-model/0.12.1/builder-model-0.12.1.jar'. Received status code 500 from server: Internal Server Error
Enable Gradle 'offline mode' and sync project
Bintray has experienced momentary timeouts yesterday due to a change to one of the cluster nodes in Dallas.
It looks like you've happened to hit that exact node at that exact time.
The issue has been sorted out after a couple of minutes, so there is no real need to change anything on your side.
Actually, keeping jcenter() in your script is preferable since it's a super-set of Maven Central.
In order to solve it, I went to File -> Project Structure -> Project and changed:
Android Plugin Repository and Default Plugin Repository from their default values of
jCenter()
to
mavenCentral
I had a similar problem and was able to use both repositories by including them both in my build.gradle in my android directory:
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
This is an adjustment to #MHDante's answer - instead of replacing one with the other, you can use both!
I was heaving the same/similar problem:
Error:A problem occurred configuring root project 'X'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:0.12.+.
Required by:
:X:unspecified
Failed to list versions for com.android.tools.build:gradle.
Could not list versions using M2 pattern 'http://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-revision.[ext]'.
Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/'. Received status code 401 from server: Authorization Required
But I resolved it by calling synchroise and then rebuilding the project.