当前位置: 首页 > 知识库问答 >
问题:

Gradle 0.9.+/0.9.2错误:无法加载类“com.android.builder.testing.api.DeviceProvider”

裴泰平
2023-03-14

今天早上,所有Android Studio项目开始失败Gradle Sync/Build/Clean:

> Could not create plugin of type 'AppPlugin'.

stacktrace看起来像:

* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':Project'.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:177)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
    at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:507)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
    at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
    at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
    at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
Caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'AppPlugin'.
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:69)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:103)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
    at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:39)
    at org.gradle.api.Project$apply.call(Unknown Source)
    at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
    at org.gradle.api.Script$apply.callCurrent(Unknown Source)
    at build_5mm5fv0emagtc49feqskf025g1.run(/projectdir/build.gradle:9)
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
    ... 53 more
Caused by: java.lang.NoClassDefFoundError: com/android/builder/testing/api/DeviceProvider
    at com.android.build.gradle.AppPlugin.$getStaticMetaClass(AppPlugin.groovy)
    at com.android.build.gradle.BasePlugin.<init>(BasePlugin.groovy:1908)
    at com.android.build.gradle.AppPlugin.<init>(AppPlugin.groovy:37)
    at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62)
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:67)
    ... 66 more
Caused by: java.lang.ClassNotFoundException: com.android.builder.testing.api.DeviceProvider
    ... 71 more

共有1个答案

钱震博
2023-03-14

根据最新的bug报告,问题是版本0.9.2是从Maven central提供的,尽管所有必要的组件都还没有可用(gradle没有将此注册为问题)。这会弄坏东西,因为碎片不见了。版本0.9.2现在已经完全可用并且可以工作,但是如果你看到这个bug,你的gradle缓存已经损坏了。

修复:

gradle --refresh-dependencies

或删除

~/.gradle/caches
classpath 'com.android.tools.build:gradle:0.9.+'

classpath 'com.android.tools.build:gradle:0.9.1'
 类似资料:
  • 关于Eclipse IDE(Indigo、Juno和Kepler(32和64位版本)) 平台:Windows、Ubuntu、Mac M2E版本:1.1.0.20120530-0009,1.2.0.20120903-1050,1.3.0.20130129-0926, 1.4.0.20130601-0317 上面的错误是在将m2e更新到1.1版之后出现的。通过删除M2E1.1并回滚到M2E1.0,一切

  • 问题内容: 我想连接我的java程序以连接数据库并检索数据。它的编译完美,但运行时即时得到这个 我已经安装了Java SQL驱动程序,并将jar路径作为CLASSPATH添加到环境变量中 问题答案: 您应该从这里下载驱动程序 和JAR文件需要添加到项目类路径。 首先,右键单击Eclipse Project,然后单击Project-> Build Path-> Configure Build Pat

  • 当我正常运行此代码时,它会吐出: 异常线程"main"java.lang.ClassNotFoundExcture: bookReader 在java.net.URLClassLoader.find类(URLClassLoader.java:381) 在java.lang.ClassLoader.load类(ClassLoader.java:424)<在sun.misc.启动$AppClassLo

  • 我无法安装/使用Maven并收到以下错误。 错误:无法找到或加载主类org.codehaus.plexus.classworlds.launcher.Launcher 安装步骤: 下载二进制zip存档(3.8.5)并将其放在根C: 在系统变量中将 Java Home 和 Maven 主页设置为“JAVA_HOME”和“MAVEN_HOME” 将系统变量中的 Path 变量分别设置为“%JAVA_H

  • 这是我的应用程序的文件夹结构 在我的文件,我像这样加载字体和资源 对于这个,运行将给出退出代码0。 在我家。dart我有以下课程: 我在其他地方使用,以显示图像(代码省略): 这座大楼没有错误。颤振博士-v没有给出任何错误,颤振分析-v也没有给出任何错误。apk似乎构建得很好,但当应用程序在我的手机上打开时,我在asset_bundle中发现以下错误。投掷: 发生异常。错误(无法加载资源:imag

  • 所以我设定了我的道路 我不知道这是怎么回事...如有任何建议,不胜感激。