android – Gradle Error和java.lang.ClassNotFoundException

我遇到的第一个错误是:

Android Studio error installing Gradle

当我修复我有一个新的错误:

Internal error: (java.lang.ClassNotFoundException) org.slf4j.LoggerFactory
java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    at org.gradle.tooling.internal.consumer.loader.DefaultToolingImplementationLoader.<clinit>(DefaultToolingImplementationLoader.java:45)
    at org.gradle.tooling.internal.consumer.ConnectorServices$ConnectorServiceRegistry.createToolingImplementationLoader(ConnectorServices.java:49)
    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.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:175)
    at org.gradle.internal.service.DefaultServiceRegistry.access$300(DefaultServiceRegistry.java:47)
    at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.create(DefaultServiceRegistry.java:336)
    at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:240)
    at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.getService(DefaultServiceRegistry.java:275)
    at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.getService(DefaultServiceRegistry.java:215)
    at org.gradle.internal.service.DefaultServiceRegistry.doGet(DefaultServiceRegistry.java:145)
    at org.gradle.internal.service.AbstractServiceRegistry.get(AbstractServiceRegistry.java:65)
    at org.gradle.internal.service.SynchronizedServiceRegistry$1.create(SynchronizedServiceRegistry.java:38)
    at org.gradle.internal.concurrent.Synchronizer.synchronize(Synchronizer.java:31)
    at org.gradle.internal.service.SynchronizedServiceRegistry.get(SynchronizedServiceRegistry.java:36)
    at org.gradle.tooling.internal.consumer.ConnectorServices.createConnector(ConnectorServices.java:36)
    at org.gradle.tooling.GradleConnector.newConnector(GradleConnector.java:64)
    at com.android.tools.idea.jps.builder.AndroidGradleBuilder.doBuild(AndroidGradleBuilder.java:266)
    at com.android.tools.idea.jps.builder.AndroidGradleBuilder.build(AndroidGradleBuilder.java:136)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1051)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:792)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:823)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:755)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:576)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:339)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:180)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:129)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:220)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:112)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:132)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    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:722)

PD:抱歉,我的英语不好,问题的格式这是我的第一个问题.

最佳答案 我有同样的java.lang.ClassNotFoundException异常,试图包含jsoup.

帮助我的是打开终端,进入项目的根源并执行

gradle clean
gradle assemble
点赞