我知道还有其他主题,但它对我们两个都不起作用。 每次我在android Studio 2.3.2上启动我的项目时都会出现此消息错误: error image
所以我决定尝试一下! :)
新日志:
10:05:37,894 [ 454389] INFO - e.project.sync.GradleSyncState - Started sync with Gradle for project 'Mobilite test recup'.
2017-05-16 10:05:37,929 [ 454424] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Java/jdk1.8.0_131
2017-05-16 10:05:37,935 [ 454430] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Java/jdk1.8.0_131
2017-05-16 10:05:37,956 [ 454451] INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [-Djava.awt.headless=true, -Pandroid.injected.build.model.only=true, -Pandroid.injected.build.model.only.advanced=true, -Pandroid.injected.invoked.from.ide=true, --init-script, D:\Profiles\valegoupil\AppData\Local\Temp\asLocalRepo1.gradle, --init-script, D:\Profiles\valegoupil\AppData\Local\Temp\ijinit.gradle]
2017-05-16 10:05:40,509 [ 457004] 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-3.2-all.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:41)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46)
at org.gradle.tooling.internal.consumer.DefaultBuildActionExecuter.run(DefaultBuildActionExecuter.java:48)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:217)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.access$200(GradleProjectResolver.java:72)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:765)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:749)
at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:227)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:112)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:72)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.lambda$resolveProjectInfo$0(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:138)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:124)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:415)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:494)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:443)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:155)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:128)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionResolveState.resolve(DependencyGraphBuilder.java:608)
[...}
2017-05-16 10:05:40,519 [ 457014] WARN - ect.sync.idea.ProjectSetUpTask -
2017-05-16 10:05:40,519 [ 457014] INFO - ect.sync.idea.ProjectSetUpTask - Connection refused: connect
Consult IDE log for more details (Help | Show Log)
2017-05-16 10:05:40,521 [ 457016] INFO - e.project.sync.GradleSyncState - Sync with Gradle for project 'Mobilite test recup' failed: Connection refused: connect
Consult IDE log for more details (Help | Show Log)
2017-05-16 10:05:40,743 [ 457238] INFO - #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s.
2017-05-16 10:05:40,743 [ 457238] INFO - #com.jetbrains.cidr.lang - Loading symbols finished in 0 s.
2017-05-16 10:05:40,744 [ 457239] INFO - #com.jetbrains.cidr.lang - Building symbols finished in 0 s.
2017-05-16 10:05:40,745 [ 457240] INFO - #com.jetbrains.cidr.lang - Saving symbols finished in 0 s.
文件build.gradle (project)
:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
subprojects {
ext.global_compileSdkVersion = 23
ext.global_buildToolsVersion = "25.0.2"
ext.global_minSdkVersion = 15
ext.global_targetSdkVersion = 23
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
abortOnError false
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:0)
您正在使用非常旧版本的构建工具。
尝试更改此内容:
classpath 'com.android.tools.build:gradle:0.7.+'
到此:
classpath 'com.android.tools.build:gradle:2.3.2'
同时检查Android Studio中的更新,确保所有内容都是最新的。
如果你在Mac上转到顶部栏,那么 Android Studio - >检查更新
在Windows中转到帮助 - >检查更新
可能在this other SO answer by DZL找到了一个解决方案,看看它是否有效:
修复方法是转到File/Settings/Build Execution Deployment/Gradle
并选中使用本地gradle分发
之后,在Gradle Home
中将位置设置为gradle directory
- 就我而言,它是C:\Program Files\Android\Android Studio\gradle\gradle-3.2