android studio 2.2.3 gradle刷新失败

时间:2017-01-05 11:49:19

标签: android android-studio android-gradle

您好我试图创建一个简单的Android应用程序但是当我创建一个新项目时,Android studio会向我显示此消息 Gradle 'MyApplication' projec refresh failed Error:org.gradle.wrapper.WrapperExecutor.forProjectDirectory(Ljava/io/File;Ljava/lang/Appendable;)Lorg/gradle/wrapper/WrapperExecutor;

我在日志中的错误看起来像这样

2017-01-05 12:11:01,543 [1098426]   INFO -       #com.jetbrains.cidr.lang - Clearing symbols finished in 0 s. 
2017-01-05 12:11:01,551 [1098434]   INFO -       #com.jetbrains.cidr.lang - Loading symbols finished in 0 s. 
2017-01-05 12:11:01,553 [1098436]   INFO -       #com.jetbrains.cidr.lang - Building symbols finished in 0 s. 
2017-01-05 12:11:01,553 [1098436]   INFO -       #com.jetbrains.cidr.lang - Saving symbols finished in 0 s. 
2017-01-05 12:11:13,264 [1110147]   INFO - ls.idea.gradle.GradleSyncState - Started sync with Gradle for project 'My Application'. 
2017-01-05 12:11:13,270 [1110153]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /opt/android-studio/jre 
2017-01-05 12:11:13,271 [1110154]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /opt/android-studio/jre 
2017-01-05 12:11:13,271 [1110154]   WARN - nal.AbstractExternalSystemTask - org.gradle.wrapper.WrapperExecutor.forProjectDirectory(Ljava/io/File;Ljava/lang/Appendable;)Lorg/gradle/wrapper/WrapperExecutor; 
java.lang.NoSuchMethodError: org.gradle.wrapper.WrapperExecutor.forProjectDirectory(Ljava/io/File;Ljava/lang/Appendable;)Lorg/gradle/wrapper/WrapperExecutor;
    at org.gradle.tooling.internal.consumer.DistributionFactory.getDefaultDistribution(DistributionFactory.java:64)
    at org.gradle.tooling.internal.consumer.DefaultGradleConnector.connect(DefaultGradleConnector.java:137)
    at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.getConnection(GradleExecutionHelper.java:397)
    at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:233)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:112)
    at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:73)
    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:138)
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:124)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:419)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$2.run(ExternalSystemUtil.java:500)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
    at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    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)
2017-01-05 12:11:13,319 [1110202]   INFO - radle.project.ProjectSetUpTask - org.gradle.wrapper.WrapperExecutor.forProjectDirectory(Ljava/io/File;Ljava/lang/Appendable;)Lorg/gradle/wrapper/WrapperExecutor;

Consult IDE log for more details (Help | Show Log) 
2017-01-05 12:11:13,319 [1110202]   INFO - ls.idea.gradle.GradleSyncState - Sync with Gradle for project 'My Application' failed: org.gradle.wrapper.WrapperExecutor.forProjectDirectory(Ljava/io/File;Ljava/lang/Appendable;)Lorg/gradle/wrapper/WrapperExecutor;

我尝试使疼痛无效并重新启动,或者[Android studio 2.2.3 building error

更多信息 IDE:Android Studio(版本号#AI-145.3537739,2016年12月2日00:00) 操作系统:Linux(4.4.0-57-generic,amd64) JRE:1.8.0_76-release-b03(JetBrains s.r.o) JVM:25.76-b03(OpenJDK 64位服务器VM) JVM Args:-Xbootclasspath/a:/opt/android-studio/bin/../lib/boot.jar -Xms256m -Xmx1280m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -da -Djna.nosys=true -Djna.boot.library.path= -Djna.debug_load=true -Djna.debug_load.jna=true -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Dawt.useSystemAAFontSettings=lcd -Djb.vmOptionsFile=/opt/android-studio/bin/studio64.vmoptions -XX:ErrorFile=/home/apasquier/java_error_in_STUDIO_%p.log -XX:HeapDumpPath=/home/apasquier/java_error_in_STUDIO.hprof -Djb.restart.code=88 -Didea.paths.selector=AndroidStudio2.2 -Didea.platform.prefix=AndroidStudio -Didea.jre.check=true

我更改了build.gradle apply plugin:'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "storing.flux.ndp.com.myapplication"
        minSdkVersion 22
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.1.0'
    testCompile 'junit:junit:4.12'
}

由于

编辑: 失败是因为我的gradle-tools和gradle-wrapper不在同一个版本中。我不知道为什么。所以我完全删除了我的计算机。谢谢你的帮助

1 个答案:

答案 0 :(得分:0)

我不确定问题是什么,但大多数情况下,Android Studio所包含的不同版本的组件存在问题。 所以首先尝试更新所有内容。 这是一个链接,向您展示如何:https://developer.android.com/studio/intro/update.html