我对Android Studio非常陌生。
安装后,我开始了一个新项目。项目打开后,我收到了Gradle同步错误:
Error:Could not create an instance of Tooling API implementation using the specified Gradle installation 'C:\Program Files\Android\Android Studio1\gradle\gradle-2.8'
我开始搜索解决方案。我尝试了很多解决方案,例如删除.gradle
文件,重新安装程序,使缓存无效并重新启动,然后我尝试单独安装gradle。输入gradle
命令得到了以下错误消息:
java.lang.ClassCastException: ch.qos.logback.classic.LoggerContext cannot be cast to org.gradle.logging.internal.slf4j.OutputEventListenerBackedLoggerContext
at org.gradle.logging.internal.slf4j.Slf4jLoggingConfigurer.configure(Slf4jLoggingConfigurer.java:42)
at org.gradle.logging.internal.DefaultLoggingConfigurer.configure(DefaultLoggingConfigurer.java:34)
at org.gradle.logging.internal.LoggingSystemAdapter.setLevel(LoggingSystemAdapter.java:52)
at org.gradle.logging.internal.LoggingSystemAdapter.on(LoggingSystemAdapter.java:39)
at org.gradle.logging.internal.DefaultLoggingManager$StartableLoggingSystem.start(DefaultLoggingManager.java:199)
at org.gradle.logging.internal.DefaultLoggingManager.start(DefaultLoggingManager.java:62)
at org.gradle.logging.internal.DefaultLoggingManager.start(DefaultLoggingManager.java:31)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
我浏览了互联网,但没有找到任何解决这些错误的方法。我发现的最近的是this。这个问题适用于Macs,我使用的是Windows 7.根据帖子,用户从来没有让Android Studio工作。
版本:
我的build.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:1.5.0'
// 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
}
我非常感谢能够让Android Studio正常运行的所有帮助。