gpt4 book ai didi

android - Intellij Idea 日志 GradleConnectionException : Could not execute build using Gradle installation while building

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:31:50 25 4
gpt4 key购买 nike

我使用 Intellij Idea 13.1.1 并且在构建时出现 GradleConnectionException:

Error:org.gradle.tooling.GradleConnectionException:
Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.:
Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.

我在这里看到了类似的问题并用谷歌搜索了一下。但这对我没有帮助。

最后我找到了 Idea 的构建日志,这是一个异常(exception),其中包含更多详细信息(抱歉,日志很长,但它只是为了提供更详细的信息):

2014-06-04 10:41:20,732 [      0]   INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = <PATH_TO_MY_PROJECT>, global options path = C:/Users/<USER_NAME>/.IdeaIC13/config/options 
2014-06-04 10:41:21,404 [ 672] INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 673 ms
2014-06-04 10:41:21,404 [ 672] INFO - jps.cmdline.JpsModelLoaderImpl - Project has 3 modules, 14 libraries
2014-06-04 10:41:21,643 [ 911] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=688586752
2014-06-04 10:41:22,288 [ 1556] INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:true parallel compilation:false
2014-06-04 10:41:22,292 [ 1560] INFO - r.api.ClassFilesIndicesBuilder - class files data index disabled
2014-06-04 10:41:22,329 [ 1597] INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2014-06-04 10:41:22,456 [ 1724] INFO - der.AndroidGradleTargetBuilder - Using execution settings: BuilderExecutionSettings[embeddedGradleDaemonEnabled=false, buildMode=SOURCE_GEN, gradleDaemonMaxIdleTimeInMs=60000, gradleDaemonCommandLineOptions=[], gradleDaemonJvmOptions=[], gradleHomeDir=C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10, gradleServiceDir=null, javaHomeDir=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre\jre, offlineBuild=false, parallelBuild=false, projectDir=<PATH_TO_MY_PROJECT>, verboseLoggingEnabled=false, modulesToBuildNames=[<PROJECT_NAME>, <PROJECT_NAME>-<PROJECT_NAME>, <PROJECT_NAME_SAMPLE>]]
2014-06-04 10:41:22,458 [ 1726] INFO - der.AndroidGradleTargetBuilder - Gradle build using tasks: [:<PROJECT_NAME>:generateDebugSources, :<PROJECT_NAME_SAMPLE>:generateDebugSources]
2014-06-04 10:41:22,460 [ 1728] INFO - der.AndroidGradleTargetBuilder - About to build project '<PROJECT_NAME>' located at <PATH_TO_MY_PROJECT>
2014-06-04 10:41:22,537 [ 1805] INFO - der.AndroidGradleTargetBuilder - Passing JVM args to Gradle Tooling API: [-Dandroid.home=C:\adt-bundle-windows-x86_64-20131030\sdk]
2014-06-04 10:41:24,934 [ 4202] INFO - .incremental.IncProjectBuilder - org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.
org.jetbrains.jps.incremental.ProjectBuildException: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:877)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:772)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:595)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:352)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:184)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:129)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:224)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:113)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:133)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:55)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:67)
at com.android.tools.idea.jps.builder.AndroidGradleTargetBuilder.doBuild(AndroidGradleTargetBuilder.java:331)
at com.android.tools.idea.jps.builder.AndroidGradleTargetBuilder.build(AndroidGradleTargetBuilder.java:131)
at com.android.tools.idea.jps.builder.AndroidGradleTargetBuilder.build(AndroidGradleTargetBuilder.java:76)
at org.jetbrains.jps.incremental.BuildOperations.buildTarget(BuildOperations.java:101)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:819)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:857)
... 14 more
Caused by: org.gradle.launcher.daemon.client.DaemonConnectionException: The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre\jre,daemonRegistryDir=C:\Users\<USER_NAME>\.gradle\daemon,pid=1644,idleTimeout=null,daemonOpts=-Dfile.encoding=windows-1251]
Actual: DefaultDaemonContext[uid=bb72a914-1081-4f81-a9b1-67c8d0a9106d,javaHome=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre,daemonRegistryDir=C:\Users\<USER_NAME>\.gradle\daemon,pid=5592,idleTimeout=60000,daemonOpts=-Dfile.encoding=windows-1251]

at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connectToDaemonWithId(DefaultDaemonConnector.java:119)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.startDaemon(DefaultDaemonConnector.java:99)
at org.gradle.launcher.daemon.client.DefaultDaemonConnector.connect(DefaultDaemonConnector.java:72)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:149)
at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:74)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:42)
at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:30)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:106)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:93)
at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:133)
at org.gradle.tooling.internal.consumer.connection.ModelBuilderBackedModelProducer.produceModel(ModelBuilderBackedModelProducer.java:44)
at org.gradle.tooling.internal.consumer.connection.GradleBuildAdapterProducer.produceModel(GradleBuildAdapterProducer.java:42)
at org.gradle.tooling.internal.consumer.connection.ModelBuilderBackedConsumerConnection.run(ModelBuilderBackedConsumerConnection.java:50)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:77)
at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:71)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:82)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:58)
at org.gradle.tooling.internal.consumer.connection.LoggingInitializerConsumerActionExecutor.run(LoggingInitializerConsumerActionExecutor.java:44)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:55)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
... 3 more

有什么想法吗?

更新

这个目录存在:

C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.1\jre\jre

我有 JAVA_HOME 变量

C:\Java\jdk1.7.0_45

我还有 2 个 gradle.properties 文件

C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10\samples\userguide\tutorial\properties\gradle.properties

C:\Users\<USER_NAME>\.gradle\wrapper\dists\gradle-1.10-all\6vpvhqu0efs1fqmqr2decq1v12\gradle-1.10\samples\signing\maven\gradle.properties

我尝试将 org.gradle.java.home=C:/Java/jdk1.7.0_45 放入其中,但它对我没有帮助。

我做错了什么?

最佳答案

在平台设置中检查您的 JDK 主路径。

在我的例子中,它有额外的“/jre”后缀,这导致了与您描述的相同的错误。

Configuring JDK home path

关于android - Intellij Idea 日志 GradleConnectionException : Could not execute build using Gradle installation while building,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24028909/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com