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.
After I update Android Studio to 3.2.1 and gradle version in my project I am getting following build error.
I have already checked lots of questions related this question but no luck.
Project dependency Build.gradle
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://maven.google.com' }
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter ()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Error
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'DemoAppppp'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:944)
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.2.1.
Required by:
project :
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:103)
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:63)
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.2.1.
at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:139)
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:96)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
Caused by: java.net.ConnectException: Connection refused: connect
Update
I just followed #CoolMind answer it solve the gradle issue, but there is another issue comes which is This
And I followed those answers which is given in this question but not solve my problem
Just turn off the Toggle Offline Mode .
On the top right side of the Window .
Click on Gradle
2nd number option(just near of Setting option)
click on it then you will be able to do work continuously.
As you can see the image
In The Right Side of the Android Studio, You can See Gradle option just click it and you will see a screen which is given below.
Gradle can be offline. If offline, you should do it online.
In my case, I have added a dependency which is not available in any of the cloud repositpories. On removing dependency,it started working
Check the below points.
Internet connectivity issue.
Toggle Offline Mode.
You might have added a dependency not available in the repository
I had this problem also. Tried all the suggestions, but didnt help. The problem was in offline/online mode as other stated but you have to also check the compiler settings. Make sure there is no --offline flag
Preferences -> Build, Execution, Deployment -> Compiler
( Menubar 'File' button, 'Settings' menu option, 'Build, Execution, Deployment' menu twisty, 'Compiler' submenu )
On Command-line Options: --stacktrace
not
--offline --stacktrace
Opening the "Gradle" side panel, and toggling the "online/offline" button to "online" worked for me as well.
Previous failed solution: I searched on Gradle's website for a manual download of version 3.6.3, but there wasn't one. That number is the same version, however, of Android Studio being used.
This problem appeared on OS X. After disabling web filtering application (some Google IPs were blocked) it disappeared. After syncing with gradle all files have been downloaded.
Also you may set a checkbox like in https://discuss.gradle.org/t/android-studio-could-not-get-resource-https-dl-google-com-dl-android-maven2-com-android-tools-build-gradle-3-1-0-gradle-3-1-0-pom/26734:
Settings -> Build … -> Gradle -> Android Studio -> Enable embedded maven repository.
See also Could not resolve com.android.tools.build.gradle:3.0.1.
If you have updated Gradle then most likely you will get this error because Gradle will be offline by default after updating.
Solution:
In right hand side top corner click Gradle (Gradle panel or Gradle window opens).
Connect Gradle to the internet by clicking the icon at the top of Gradle panel or window.
This problem occurs when your android studio is not getting internet connection. You fix the internet, the problem fixes by itself.
To confirm the internet issue of the android studio you can attempt to login, update, connecting to firebase, etc all will fail.
For me, the issue was organization's Artifactory password got changed needed to update Gradle with new credentials.
upgrade project to androidx
change compile to implementation
change v4 or v7 to androidx dependencies
My problem was because a version was wrong in the dependencies in build.gradle (app). If you have internet, it might be because of this, so try finding other warnings that might indicate a wrong dependency.
This Works 100%
turn off the Toggle Offline Mode .
Check the image below
Just you have to turn on the Toggle button, come in the grade menu at the right side of the window... So you going to online mode.. you must have internet connection for.. build grade.. otherwise it's again show you same error or other types of error...
I also have been having the same error since when i updated my Android studio and even with a fast internet network am unable to start a new project but today I discover a solution just click o your event log and update any suggested plugin that shows up and rebuild your project, then your have your project working well and fine it worked for me trust it to work for you also .
This error may arrises due to "android:exported="false"". please make sure when to use "android:exported="true/false"".
In my case none of the above helped. I had to upgrade my FLIPPER_VERSION in my gradle.properties file. You can find the latest FLIPPER_VERSION here: https://github.com/facebook/flipper/releases
Deleting my .gradle file ("C:\Users<userName>.gradle") and going to the device manager and running "Cold Boot Now" fixed this problem for me
Try to Toggle Offline Mode, if not worked check your flipper version if it is old try to update it(worked for me). Upgrading flipper version in gradle.properties
From
FLIPPER_VERSION=0.39.0
To
FLIPPER_VERSION=0.99.0
In my case I added maven repository in both repository section , so this issue occurs, So I removed this line from above repotories section inside buildscript
for reference visit this answer https://stackoverflow.com/a/75005827/12748481
I am not able to work with the gradle dependencies on the MAC.
I am getting this error :
Could not GET
'http://jcenter.bintray.com/com/android/tools/build/gradle/2.0.0/gradle-2.0.0.pom'. Received status code 407 from server: Proxy Authentication Required
Its a proxy issue.
I have though set the proxy in the gradle.properties as well and in the Settings>Https as well.
I am able to download the SDK but not the gradle plugin.
If i try to click the link in the error , I get redirected to the gradle site (on Safari) and 1Kb of pom file gets downloaded itself.
I am wondering that somehow the safari application has the correct setting for the proxy thats why it is able to downloaded the pom file
but from within the android studio , somewhere authentication is failing and hence it is failing.
Is there any other place i have to put the proxy or any test to test the correct way of working the proxy from within the Android Studio.
already added jcenter in build.gradle :
jcenter() {
url "http://jcenter.bintray.com/"
}
I have already checked the "check connection" by providing the url(which came in the error) ->
and it says connection successfull.
WHats the hidden mystery here to solve this issue?
thanks in advance !
Add jcenter() to your list of repositories and Gradle should find version 2.0.0
Facing the following issue with Android Studio after an update today.
Error
Unknown host 'This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server'. You may need to adjust the proxy settings in Gradle.
Enable Gradle 'offline mode' and sync project
Learn about configuring HTTP proxies in Gradle
When I click on "Enable offline mode", get the following error:
Error:No cached version of com.android.tools.build:gradle:2.14.1 available for offline mode.
Disable Gradle 'offline mode' and sync project
What I have tried:
Options are based on other posts/ suggestions:
a. File > Settings > Build, Execution, Developement > Gradle
Selected the right folder for Gradle.
b. Updated build.gradle file (Project file and NOT Module)
//classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.android.tools.build:gradle:2.14.1'
Despite these changes .. the error persists.
Any help or suggestions .. thanks in advance !
When I update to 1.5.1 the classpath was
classpath com.android.tools.build:gradle:1.2.3
It give me error like yours.
I tried to change it to
classpath com.android.tools.build:gradle:1.5.1
It didn't work but when I change it to
classpath com.android.tools.build:gradle:1.5.0
It worked.
So you should give it a shot play with the numbers it might work.
File > Settings > Build, Execution, Developement > Gradle>Experimental> Check: "Allow Module selection on project import"
2.Sync Gradle again
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'**
}
}