Failed to install Gradle distribution with 'https://services.gradle.org/distributions/gradle-2.1-all.zip'

I am greenhorn in gradle and I just tried to create a new Android gradle project in IntelliJ. After filling in the necessary things, he began to download something that took hours, so I decided to get out of my IDE and open the project again.

And now I get this: enter image description here

And when I open the IDE logs, I see the following:

2014-12-13 22:27:37,940 [103759372] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at '/Users/ramswaroop/Documents/My Workspace/PopoPics' org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'. at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:124) at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:112) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46) at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:46) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:177) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$300(GradleProjectResolver.java:63) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:363) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:335) at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:214) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:95) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:63) at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41) at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37) at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59) at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37) at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49) at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:51) at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137) at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:475) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3$2.run(ExternalSystemUtil.java:552) at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:621) at com.intellij.openapi.progress.impl.ProgressManagerImpl$3.run(ProgressManagerImpl.java:194) at com.intellij.openapi.progress.impl.ProgressManagerImpl.a(ProgressManagerImpl.java:281) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233) at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:181) at com.intellij.openapi.progress.impl.ProgressManagerImpl$9.run(ProgressManagerImpl.java:530) at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56) Caused by: java.nio.channels.OverlappingFileLockException at sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(FileChannelImpl.java:1166) at sun.nio.ch.FileChannelImpl$SharedFileLockTable.add(FileChannelImpl.java:1068) at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:868) at java.nio.channels.FileChannel.tryLock(FileChannel.java:962) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:51) at org.gradle.wrapper.Install.createDist(Install.java:44) at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:118) at org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution$1.call(DistributionFactory.java:112) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) 2014-12-13 22:27:37,941 [103759373] WARN - nal.AbstractExternalSystemTask - Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'. com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'. at org.jetbrains.plugins.gradle.service.project.AbstractProjectImportErrorHandler.createUserFriendlyError(AbstractProjectImportErrorHandler.java:106) at org.jetbrains.plugins.gradle.service.project.BaseProjectImportErrorHandler.getUserFriendlyError(BaseProjectImportErrorHandler.java:158) at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.getUserFriendlyError(BaseGradleProjectResolverExtension.java:401) at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:309) at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:164) at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:164) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:369) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:335) at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:214) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:95) at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:63) at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41) at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37) at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59) at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37) at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49) at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:51) at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137) at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:475) at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3$2.run(ExternalSystemUtil.java:552) at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:621) at com.intellij.openapi.progress.impl.ProgressManagerImpl$3.run(ProgressManagerImpl.java:194) at com.intellij.openapi.progress.impl.ProgressManagerImpl.a(ProgressManagerImpl.java:281) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:233) at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:181) at com.intellij.openapi.progress.impl.ProgressManagerImpl$9.run(ProgressManagerImpl.java:530) at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56) 2014-12-13 22:27:37,942 [103759374] WARN - radle.project.ProjectSetUpTask - 2014-12-13 22:27:37,942 [103759374] INFO - radle.project.ProjectSetUpTask - Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip'. Consult IDE log for more details (Help | Show Log) 

INFO: Working on Mac Yosemite with gradle 2.2 and IntelliJ IDEA 14 Ultimate.

+14
source share
12 answers

Perhaps gradle-2.1 specified by the shell was not loaded properly. This was the main cause of the same problem in my environment.

Look into this directory:

 ls -l ~/.gradle/wrapper/dists/ 

There you should find the gradle-2.1 folder. Delete it like this:

 rm -rf ~/.gradle/wrapper/dists/gradle-2.1-bin/ 

Restart IntelliJ, after that it will restart the download from the very beginning and hopefully will work.

Thank you, Ioannis

+22
source

If you are on Windows, you can go to:

C: \ Users \ {your_name} \ Gradle .

And delete all the links of the gradle package that you can find in these folders:

  • caches
  • demon
  • wrapper

Then reopen the project and sync gradle

+12
source

First check your internet connection.

or try

Tools → Android → Sync

or try

File → Settings → Gradle → Battery Check

enter image description here

+3
source

I have the same problem. (My problem with Gradle 4.4 files)

Actually the problem is the wrong loading of 4.4 gradle, which I already had. When I uninstall Gradle 4.4 version C: \ Users \ $ Your_User.gradle \ wrapper \ dists \ gradle-4.4-all

Android Studio downloads Gradle-4.4 again and syncs with my project.

Now this is fixed with Michelin Mans

Thank you for your Michelin answer.

+2
source

The appropriate version of Gradle may have been downloaded incorrectly.

You can delete the broken file in

 rm -rf .gradle/wrapper/dists/ 

and restart the studio.

or try

 File -> Settings -> Gradle -> Check Offline Work 

and download the file from the official site and extract it to the destination

 .gradle/wrapper/dists/ 
+1
source

In Android Studio, if you open the Design window for an application, the Gradle error message will not sync correctly. The "Try Again" button appears next to the error. If you click on this, Android Studio will try to raise the score again.

It worked for me.

+1
source

You should also check if you are connecting through a proxy. If the proxy server configured it using File> Preferences> Appearance and Behavior> System Settings> HTTP Proxy

0
source

Another reason for this error (provided gradle is configured correctly) is the incompatibility between the andorid.gradle tools and gradle itself - check this answer for a full compatibility table.

In my case, the error was the same as in the question and the stack trace, as shown below:

 java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at com.android.build.gradle.BasePlugin.lambda$configureProject$1(BasePlugin.java:436) at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42) ... 

I fixed this by updating com.android.tools.build:gradle to the latest version 3.1.4

 buildscript { repositories { ... } dependencies { classpath 'com.android.tools.build:gradle:3.1.4' } } 

Gradle version 4.6

0
source

https://services.gradle.org/distributions/gradle-2.1-all.zip

open this link in your browser, download the zip file and unzip it to a folder

Before extracting, please delete the old folder whose name ends with gradle-2.1-all, and then you can start the extraction

if you are a window user, unzip it to this folder

C: \ Users {Your-Name} .gradle \ wrapper \ dists

after that just restart your android studio. I hope this works, it works for me.

0
source

I ran into the same problem in IntelliJ. This worked from the command line though.

I found that the problem was due to an incorrect Gradle configuration in the IDE. I did not use the "default Gradle wrapper" as recommended:

enter image description here

0
source

In my case, I had to go to

File → Settings → Build, Execution, Deployment → Gradle

and then I changed the Service directory path , which was pointing to the wrong location.

0
source

On the MAC, delete the gradle-2.1-all folder at the following path /Users/amitsapra/.gradle/wrapper/dists/gradle-2.1-all, and then try to build gradle again. I ran into the same problems with 5.4.1-all.

It will take a little time, but fix it

0
source

Source: https://habr.com/ru/post/979567/


All Articles