我最近更新了我的Android Studio以更改稳定版本,并将Gradle更新为2.10但从那时起我在尝试同步Gradle时收到此错误。
Error:Cannot configure the 'publishing' extension after it has been accessed.
build logs
显示了这一点:
…
Error:FAILURE: Build failed with an exception.
* Where:
Script …\apphome\app\libs\volley\bintray.gradle' line: 43
* What went wrong:
A problem occurred evaluating script.
> Cannot configure the 'publishing' extension after it has been accessed.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
…
和idea.log
:
2016-04-17 14:30:30,340 [2529786] INFO - ls.idea.gradle.GradleSyncState - Started sync with Gradle for project 'MyApp'.
2016-04-17 14:30:30,358 [2529804] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Java/jdk1.7.0_79
2016-04-17 14:30:30,360 [2529806] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Java/jdk1.7.0_79
2016-04-17 14:30:30,362 [2529808] INFO - util.EmbeddedDistributionPaths - Looking for embedded Maven repo at 'F:\Softwares\prebuilts\tools\common\offline-m2'
2016-04-17 14:30:30,375 [2529821] INFO - .project.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [-Pandroid.injected.build.model.only=true, -Pandroid.injected.build.model.only.advanced=true, -Pandroid.injected.invoked.from.ide=true, --init-script, C:\Users\Murphy\AppData\Local\Temp\ijinit4.gradle]
2016-04-17 14:30:32,497 [2531943] INFO - .project.GradleProjectResolver - Gradle project resolve error
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.10-all.zip'.
...
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
at bintray_axfkbvi7vsdypemi47d2wod1p.run(F:\AndroidstudioProjects\MyApp\app\libs\volley\bintray.gradle:43)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 73 more
2016-04-17 14:30:32,499 [2531945] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at 'F:/AndroidstudioProjects/MyApp'
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.10-all.zip'.
...
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:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
Caused by: org.gradle.internal.exceptions.LocationAwareException: Script 'F:\AndroidstudioProjects\MyApp\app\libs\volley\bintray.gradle' line: 43
A problem occurred evaluating script.
...
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating script.
...
at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
at bintray_axfkbvi7vsdypemi47d2wod1p.run(F:\AndroidstudioProjects\MyApp\app\libs\volley\bintray.gradle:43)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 73 more
2016-04-17 14:30:32,503 [2531949] WARN - nal.AbstractExternalSystemTask - Cannot configure the 'publishing' extension after it has been accessed.
com.intellij.openapi.externalSystem.model.ExternalSystemException: Cannot configure the 'publishing' extension after it has been accessed.
...
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:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
2016-04-17 14:30:32,504 [2531950] WARN - radle.project.ProjectSetUpTask -
2016-04-17 14:30:32,505 [2531951] INFO - radle.project.ProjectSetUpTask - Cannot configure the 'publishing' extension after it has been accessed.
Consult IDE log for more details (Help | Show Log)
2016-04-17 14:30:32,505 [2531951] INFO - ls.idea.gradle.GradleSyncState - Sync with Gradle for project 'MyApp' failed: Cannot configure the 'publishing' extension after it has been accessed.
Consult IDE log for more details (Help | Show Log)
2016-04-17 14:30:32,720 [2532166] INFO - #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s.
2016-04-17 14:30:32,725 [2532171] INFO - #com.jetbrains.cidr.lang - Loading symbols finished in 0 s.
2016-04-17 14:30:32,728 [2532174] INFO - #com.jetbrains.cidr.lang - Building symbols finished in 0 s.
2016-04-17 14:30:32,728 [2532174] INFO - #com.jetbrains.cidr.lang - Saving symbols finished in 0 s.
我还尝试从构建依赖项中排除volley
依赖项,但仍然存在错误。还尝试了this解决方案但我的volley的build.gradle不包含指定的行。我准备重新安装降级gradle但不知道如何做到这一点。请提出解决方案。