title: Gradle error: Could not create plugin of type 'LibraryPlugin'
body: <p>I'm building an Android library (uservoice, if that matters), using gradle 2.1, plugin 0.13. This is the build file</p>
  
  <pre><code>    buildscript {
      repositories {
          mavenCentral()
      }
  
      dependencies {
          classpath 'com.android.tools.build:gradle:0.13.+'
      }
  }
  
  apply plugin: 'com.android.library'
  
  repositories {
      mavenCentral()
  }
  
  android {
      compileSdkVersion 19
      buildToolsVersion '19.1.0'
  
      android {
          lintOptions {
              abortOnError false
          }
      }
  
      sourceSets {
          main {
              manifest.srcFile 'AndroidManifest.xml'
              java.srcDirs = ['src']
              resources.srcDirs = ['src']
              res.srcDirs = ['res']
          }
      }
  }
  
  dependencies {
      compile 'com.android.support:support-v4:20.+'
      compile 'commons-codec:commons-codec:1.8'
      compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'
      compile 'oauth.signpost:signpost-core:1.2.1.2'
  }
  </code></pre>
  
  <p>I always hit this error when compiling in terminal:</p>
  
  <blockquote>
    <p>Could not create plugin of type 'LibraryPlugin'.</p>
  </blockquote>
  
  <p>As you may notice, the plugin is named 'com.android.library' to comply with gradle 13 build tool, even if I changed back to 'android-library' it doesn't help. </p>
  
  <p>Oddly enough, if I build by hitting a task in Gradle window of Android Studio (the pane on the right), the error didn't happen.</p>
  
  <p>Anyone encountered this before? your solution/workaround? </p>
  
  <p>Updated: running <code>gradle assembleDebug --debug</code> shows the following: </p>
  
  <pre><code>8:24:06.991 [ERROR] [org.gradle.BuildExceptionReporter] Build file 'C:\Users\Tung\myprojects\project_name\libraries\uservoice-android-sdk\UserVoiceSDK\build.gradle' line: 11
  18:24:06.991 [ERROR] [org.gradle.BuildExceptionReporter]
  18:24:06.992 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
  18:24:06.992 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating project ':UserVoiceSDK'.
  18:24:06.992 [ERROR] [org.gradle.BuildExceptionReporter] &gt; Could not create plugin of type 'LibraryPlugin'.
  18:24:06.993 [ERROR] [org.gradle.BuildExceptionReporter]
  18:24:06.994 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
  18:24:06.995 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.GradleScriptException: A problem occurred evaluating project ':UserVoiceSDK'.
  18:24:06.996 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
  18:24:06.997 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:152)
  18:24:06.997 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:40)
  18:24:06.998 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
  18:24:06.998 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
  18:24:06.998 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
  18:24:06.999 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:493)
  18:24:06.999 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractProject.evaluationDependsOn(AbstractProject.java:597)
  18:24:07.000 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractProject.evaluationDependsOn(AbstractProject.java:589)
  18:24:07.000 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.Project$evaluationDependsOn.call(Unknown Source)
  18:24:07.001 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin$_ensureConfigured_closure158.doCall(BasePlugin.groovy:2472)
  18:24:07.001 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin.ensureConfigured(BasePlugin.groovy:2471)
  18:24:07.002 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin.resolveDependencyForConfig(BasePlugin.groovy:2389)
  18:24:07.002 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin.this$2$resolveDependencyForConfig(BasePlugin.groovy)
  18:24:07.002 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin$this$2$resolveDependencyForConfig.callCurrent(Unknown Source)
  18:24:07.003 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin.resolveDependencies(BasePlugin.groovy:2308)
  18:24:07.004 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.internal.VariantManager.createTasksForDefaultBuild(VariantManager.java:311)
  18:24:07.004 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:169)
  18:24:07.005 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.internal.VariantManager$createAndroidTasks.call(Unknown Source)
  18:24:07.005 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:427)
  18:24:07.006 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin$_apply_closure7.doCall(BasePlugin.groovy:338)
  18:24:07.007 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
  18:24:07.007 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
  18:24:07.008 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)
  18:24:07.008 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
  18:24:07.009 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
  18:24:07.010 [ERROR] [org.gradle.BuildExceptionReporter]        at $Proxy12.afterEvaluate(Unknown Source)
  18:24:07.010 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
  18:24:07.010 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
  18:24:07.012 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:493)
  18:24:07.012 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:80)
  18:24:07.013 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
  18:24:07.014 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
  18:24:07.014 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
  18:24:07.014 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
  18:24:07.015 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
  18:24:07.015 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
  18:24:07.016 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
  18:24:07.016 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
  18:24:07.016 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
  18:24:07.017 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  18:24:07.017 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.017 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
  18:24:07.018 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.018 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
  18:24:07.019 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.019 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
  18:24:07.019 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.020 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
  18:24:07.020 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.020 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
  18:24:07.021 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
  18:24:07.021 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.util.Swapper.swap(Swapper.java:38)
  18:24:07.022 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
  18:24:07.022 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.023 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
  18:24:07.023 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  18:24:07.024 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.024 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
  18:24:07.026 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  18:24:07.027 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.027 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
  18:24:07.028 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
  18:24:07.028 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
  18:24:07.029 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
  18:24:07.030 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.030 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
  18:24:07.031 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.031 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)
  18:24:07.032 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.032 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
  18:24:07.033 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
  18:24:07.034 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
  18:24:07.034 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
  18:24:07.035 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
  18:24:07.035 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
  18:24:07.036 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
  18:24:07.036 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'LibraryPlugin'.
  18:24:07.037 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:67)
  18:24:07.037 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:103)
  18:24:07.038 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)
  18:24:07.038 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)
  18:24:07.038 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:116)
  18:24:07.039 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
  18:24:07.039 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:85)
  18:24:07.039 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:129)
  18:24:07.040 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:41)
  18:24:07.040 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.Project$apply.call(Unknown Source)
  18:24:07.041 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
  18:24:07.041 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.Script$apply.callCurrent(Unknown Source)
  18:24:07.042 [ERROR] [org.gradle.BuildExceptionReporter]        at build_1e17m4j0u0t5o8s8i7cb99alap.run(C:\Users\Tung\tripgo-grad-space\tripgo-android\libraries\uservoice-android-sdk\UserVoiceSDK\build.gradle:11)
  18:24:07.042 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
  18:24:07.042 [ERROR] [org.gradle.BuildExceptionReporter]        ... 76 more
  18:24:07.043 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
  18:24:07.043 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin.getLocalVersion(BasePlugin.groovy:2956)
  18:24:07.043 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.BasePlugin.&lt;init&gt;(BasePlugin.groovy:243)
  18:24:07.044 [ERROR] [org.gradle.BuildExceptionReporter]        at com.android.build.gradle.LibraryPlugin.&lt;init&gt;(LibraryPlugin.groovy:40)
  18:24:07.044 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62)
  18:24:07.045 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.api.internal.plugins.DefaultPluginRegistry.loadPlugin(DefaultPluginRegistry.java:65)
  18:24:07.046 [ERROR] [org.gradle.BuildExceptionReporter]        ... 89 more
  18:24:07.047 [ERROR] [org.gradle.BuildExceptionReporter]
  18:24:07.047 [LIFECYCLE] [org.gradle.BuildResultLogger]
  </code></pre>
  
  <p><strong>Update 2:</strong> Real problem is my command line was pointing to old gradle (1.2) instead of new one (2.1), so I just changed my PATH var. Problem solved.</p>