我是gradle的新手,我只是尝试在IntelliJ中创建一个新的Android Gradle项目。在填满必需品后,它开始下载需要花费数小时的东西,所以我决定强制退出我的IDE并再次打开项目。
现在我得到了这个:
当我打开IDE日志时,我看到了:
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:使用Gradle 2.2和IntelliJ IDEA 14 Ultimate在Mac Yosemite上运行。
答案 0 :(得分:15)
可能是包装器指定的gradle-2.1
分发未正确下载。这是我环境中同样问题的根本原因。
查看此目录:
ls -l ~/.gradle/wrapper/dists/
在那里你应该找到一个gradle-2.1
文件夹。
像这样删除它:
rm -rf ~/.gradle/wrapper/dists/gradle-2.1-bin/
重新启动IntelliJ,之后它将从头开始重新下载,希望能够正常工作。
谢谢, 扬
答案 1 :(得分:6)
如果您使用的是Windows,则可以访问:
<强> C:\用户\ {your_name} \ gradle这个强>
。
并删除您可以在这些文件夹中找到的gradle包的所有引用:
然后重新打开您的项目并同步gradle
答案 2 :(得分:3)
首先检查您的互联网连接..
或尝试使用
工具 - &gt; Android - &gt;同步强>
或尝试
文件 - &gt;设置 - &gt; Gradle - &gt;检查离线工作
答案 3 :(得分:2)
1关闭Android Studio(AS)
2删除C:\ Users.gradle \ wrapper \ dists \ gradle-2.1-all中的文件夹
3以管理员身份运行AS
4同步项目文件
答案 4 :(得分:1)
在Android Studio中,如果您打开应用程序的“设计”窗口,则会显示有关Gradle未正确同步的错误消息。错误旁边有一个“再试一次”按钮。如果单击它,Android工作室会尝试再次进行sycn。
这对我有用。
答案 5 :(得分:1)
我有同样的问题。 (我的问题是gradle 4.4文件)
实际上,问题是我已经下载了4.4 gradle。 当我删除gradle 4.4版本时 C:\ Users \ $ Your_User.gradle \ wrapper \ dists \ gradle-4.4-all
Android Studio再次下载gradle-4.4并与我的项目同步。
现在它已经在米其林·曼的帮助下纠正了
感谢您的回答米其林
答案 6 :(得分:1)
可能是相应的Gradle版本未正确下载。
您可以在
删除损坏的文件rm -rf .gradle/wrapper/dists/
并重启工作室。
或尝试
File -> Settings -> Gradle -> Check Offline Work
从官方网站下载文件并解压到目的地
.gradle/wrapper/dists/
答案 7 :(得分:1)
就我而言,问题是我没有连接到与我安装 Android Studio 相同的 VPN,我不知道为什么会发生这种情况,但是即使我可以访问互联网,如果我没有连接到原来的VPN,从 IDE 下载无法正常工作。
我连接了 VPN,我再次做了 gradle,最后它开始正确下载和安装所有东西。 我还检查了我的 Android 配置中没有通过任何代理或任何类似的东西。
答案 8 :(得分:1)
更改您的项目文件夹\gradle\wrapper\gradle-wrapper 中的distributionUrl=https://services.gradle.org/distributions/gradle-2.1-bin.zip。属性到新的。
答案 9 :(得分:0)
这是在 Windows 10 上对我有用的方法。
关闭我的项目。 关闭 Android Studio。 运行安卓工作室。 打开项目。
Android Studio 需要几分钟时间,而一切都会自行解决。
我认为 Android Studio 可能只需要足够的权限来提取文件并将其放置在所有正确的位置,并可能设置路径变量。
答案 10 :(得分:0)
我无法相信下面的解决方案,但它确实解决了它。 在 gradle-wrapper.properties 文件中: 改变
distributionUrl=http\://services.gradle.org/distributions/gradle-6.1.1-all.zip
到
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
答案 11 :(得分:0)
答案 12 :(得分:0)
伙计们,在我的情况下,gradle 没有正确安装,这就是我遇到这个问题的原因。
分辨率:
答案 13 :(得分:0)
就我而言,我用
解决了这个问题答案 14 :(得分:0)
(仅适用于 Mac 用户) 从链接下载gradle文件,然后关闭项目然后在首页,在创建项目选项下有一个名为Import project(Gradle,Eclipse ADT,etc)的选项,在这里你必须选择你之前下载的gradle文件. 然后重启Android studio .....希望你的问题现在解决
答案 15 :(得分:0)
如果上述所有解决方案均无法正常运行,并且如果您的项目运行正常并且现在出现了此问题,请尝试此操作
答案 16 :(得分:0)
这也很困扰我,但现在很好 解决方案非常简单(书面打击) [window(android studio)]
答案 17 :(得分:0)
对我来说,这只是关闭android studio并以管理员身份重新启动。
答案 18 :(得分:0)
我也已经在InteliJ内部收到此问题。
转到gradle / wrapper文件夹,然后将gradle-wrapper.properties内部的distributionUrl修改为正确的版本。
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
答案 19 :(得分:0)
您还应该检查您是否通过代理连接。如果有代理使用File&gt;设置它设置&gt; <外观和行为>系统设置&gt; HTTP代理
答案 20 :(得分:0)
对我来说,原因是下载的gradle.zip IDE已损坏(我无法手动将其解压缩),并且以下步骤会有所帮助。
could not install from ${link}, ${gralde.zip} ...
.lck
文件。注意:
-$ {link}类似于https://services.gradle.org/distributions/gradle-4.6-all.zip
-$ {gradle.zip}看起来像~/.gradle/wrapper/dists/gradle-${version}-all/${a-serial-string}/gradle-${version}-all.zip
答案 21 :(得分:0)
.gradle
数据此方法解决了我的问题。
答案 22 :(得分:0)
在MAC上从以下路径/Users/amitsapra/.gradle/wrapper/dists/gradle-2.1-all中删除gradle-2.1-all文件夹,然后再次尝试构建gradle。我在5.4.1-all上也遇到了同样的问题。
需要一些时间,但可以解决所有问题
答案 23 :(得分:0)
就我而言,我必须去
File -> Settings -> Build, Execution, Deployment -> Gradle
然后我更改了指向错误位置的Service directory path
。
答案 24 :(得分:0)
答案 25 :(得分:0)
https://services.gradle.org/distributions/gradle-2.1-all.zip
在浏览器中打开此链接,下载zip文件并将其解压缩到文件夹
提取之前,请删除名称以gradle-2.1-all结尾的旧文件夹,然后即可开始提取
如果您是窗口用户,则将其解压缩到此文件夹
C:\ Users {您的名字} .gradle \ wrapper \ dists
之后,只需重新启动android studio。 我希望它对我有用。
答案 26 :(得分:0)
发生此错误的另一个原因(假设gradle设置正确)是andorid.gradle工具与gradle自身之间的不兼容-请查看getRGBWithTint以获得完整的兼容性表。
在我的情况下,错误与问题和stacktrace中的错误相同,如下所示:
tint
我已通过将import java.io.FileInputStream;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.apache.poi.hssf.util.HSSFColor;
public class ReadExcelColorHavingTint {
private static String getFillColorHex(Cell cell) throws Exception {
String fillColorString = "none";
if (cell != null) {
CellStyle cellStyle = cell.getCellStyle();
Color color = cellStyle.getFillForegroundColorColor();
if (color instanceof XSSFColor) {
XSSFColor xssfColor = (XSSFColor)color;
byte[] argb = xssfColor.getARGB();
fillColorString = "[" + (argb[0]&0xFF) + ", " + (argb[1]&0xFF) + ", " + (argb[2]&0xFF) + ", " + (argb[3]&0xFF) + "]";
if (xssfColor.hasTint()) {
fillColorString += " * " + xssfColor.getTint();
byte[] rgb = xssfColor.getRGBWithTint();
fillColorString += " = [" + (argb[0]&0xFF) + ", " + (rgb[0]&0xFF) + ", " + (rgb[1]&0xFF) + ", " + (rgb[2]&0xFF) + "]" ;
}
} else if (color instanceof HSSFColor) {
HSSFColor hssfColor = (HSSFColor)color;
short[] rgb = hssfColor.getTriplet();
fillColorString = "[" + rgb[0] + ", " + rgb[1] + ", " + rgb[2] + "]";
}
}
return fillColorString;
}
public static void main(String[] args) throws Exception {
Workbook workbook = WorkbookFactory.create(new FileInputStream("workbook.xlsx"));
//Workbook workbook = WorkbookFactory.create(new FileInputStream("workbook.xls"));
Sheet sheet = workbook.getSheetAt(0);
for (Row row : sheet) {
for (Cell cell : row) {
System.out.println("Cell=" + cell.getAddress() + " " + cell.toString() + " " + getFillColorHex(cell));
}
}
}
}
升级到最新的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)
...
com.android.tools.build:gradle
Gradle版本为4.6
答案 27 :(得分:-1)
我通过手动从 https://services.gradle.org/distributions/gradle-2.1-all.zip 下载 zip 文件,将其放入 C:\Users\<username>\.gradle
并同步来解决它。