Android Studio 2.0 Gradle错误[NoClassDefFoundError:无法初始化类org.G



不知道发生了什么。大约一个小时前,我刚刚在Ubuntu 15.10上将Android Studio从1.5.1版本更新到2.0版本。

似乎找不到Gradle或者Gradle有问题。找出Gradle版本并安装最新版本是有意义的,但安卓工作室似乎在线获取了Gradle版本,并使用项目级Gradle构建文件中的依赖项来完成

// 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.1.0'
        classpath 'com.google.gms:google-services:2.1.0-alpha5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

我向谷歌提交了一份Bug报告。老实说,我不知道为什么会发生这种事。

我尝试过"使缓存无效/重新启动"-没有帮助。

我在这个构建文件中尝试了以下版本的Gradle:

classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:1.5.1'
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.android.tools.build:gradle:2.1.0'

这些都不起作用。每个都有相同的错误。不知道为什么。错误如下:

8:41:26 AM Gradle sync started
8:41:26 AM Gradle sync failed: org.gradle.internal.SystemProperties.getInstance()Lorg/gradle/internal/SystemProperties;
           Consult IDE log for more details (Help | Show Log)
8:42:32 AM NoClassDefFoundError: Could not initialize class org.gradle.StartParameter
  • 上午8:41:26-发生在开机时
  • 上午8:42:32-发生在"清洁项目"one_answers"重建项目"

提前谢谢。


日志输出:

2016-04-11 09:17:51,545 [  69021]   WARN - nal.AbstractExternalSystemTask - org.gradle.internal.SystemProperties.getInstance()Lorg/gradle/internal/SystemProperties; 
java.lang.NoSuchMethodError: org.gradle.internal.SystemProperties.getInstance()Lorg/gradle/internal/SystemProperties;
    at org.gradle.initialization.BuildLayoutParameters.<clinit>(BuildLayoutParameters.java:28)
    at org.gradle.StartParameter.<clinit>(StartParameter.java:51)
    at org.jetbrains.plugins.gradle.service.GradleInstallationManager.getWrappedGradleHome(GradleInstallationManager.java:531)
    at org.jetbrains.plugins.gradle.service.GradleInstallationManager.getGradleHome(GradleInstallationManager.java:205)
    at org.jetbrains.plugins.gradle.service.GradleInstallationManager.doGetGradleHome(GradleInstallationManager.java:191)
    at org.jetbrains.plugins.gradle.service.GradleInstallationManager.getGradleHome(GradleInstallationManager.java:127)
    at org.jetbrains.plugins.gradle.GradleManager$4.fun(GradleManager.java:144)
    at org.jetbrains.plugins.gradle.GradleManager$4.fun(GradleManager.java:139)
    at com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil.getExecutionSettings(ExternalSystemApiUtil.java:776)
    at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.doCreateFacade(ExternalSystemFacadeManager.java:202)
    at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.doGetFacade(ExternalSystemFacadeManager.java:178)
    at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager.doInvoke(ExternalSystemFacadeManager.java:133)
    at com.intellij.openapi.externalSystem.service.ExternalSystemFacadeManager$MyHandler.invoke(ExternalSystemFacadeManager.java:270)
    at com.sun.proxy.$Proxy145.getResolver(Unknown Source)
    at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:48)
    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:366)
    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)
    at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:55)
2016-04-11 09:17:51,549 [  69025]   INFO - radle.project.ProjectSetUpTask - org.gradle.internal.SystemProperties.getInstance()Lorg/gradle/internal/SystemProperties;

更新-已修复

我删除了所有的android工作室文件,项目文件(我在Git上有所有的东西)并重新安装。

我仍然有问题,但这只是因为我忘记删除旧的渐变文件,如这里的答案所示。

不要更新到2.0 YET

这太令人沮丧了。现在虚拟设备出现问题。"无法在模拟器中启动AVD"。不要像我一样,在软件发布的那天就安装它。等几周!

这对我从gradle转到build.gradle很有效。脚本

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"
    defaultConfig {
        applicationId "CHANGE THIS XXXXXXX OWN APP ID"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

相关内容

  • 没有找到相关文章

最新更新