Android Studio:未找到 ID 为“android-library"的插件 [英] Android Studio: Plugin with id 'android-library' not found

查看:31
本文介绍了Android Studio:未找到 ID 为“android-library"的插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试让 ActionBarSherlock 工作,但遇到了一些问题.我在尝试构建它时遇到的一个问题是以下消息:

I've been trying to get ActionBarSherlock to work and having some issue. One issue I've come across is the following message when trying to build it:

Plugin with id 'android-library' not found

特别是:

D:\Projects\Android\actionbarsherlock>D:\Projects\Android\gradlew --info build
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file 
  'D:\Projects\Android\actionbarsherlock\build.gradle'.
Included projects: [root project 'actionbarsherlock']
Evaluating root project 'actionbarsherlock' using build file 
  'D:\Projects\Android\actionbarsherlock\build.gradle'.

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\Projects\Android\actionbarsherlock\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating root project 'actionbarsherlock'.
> Plugin with id 'android-library' not found.

我在一个单独的线程中将此视为 ABS 问题,所以在这里我很好奇如何解决以下一般问题:

I'm treating this as an ABS issue in a seperate thread, so here I'm curious how to address the general issue of:

Plugin with id 'android-library' not found

这是build.gradle:

Here is the build.gradle:

apply plugin: 'android-library'

dependencies {
  compile 'com.android.support:support-v4:18.0.+'
}

android {
  compileSdkVersion 14
  buildToolsVersion '17.0.0'

  sourceSets {
    main {
      manifest.srcFile 'AndroidManifest.xml'
      java.srcDirs = ['src']
      res.srcDirs = ['res']
    }
  }
}

你能帮忙吗?

推荐答案

指示 Gradle 从 Maven 中央存储库下载 Android 插件.

Instruct Gradle to download Android plugin from Maven Central repository.

您可以通过在 Gradle 构建文件的开头粘贴以下代码来实现:

You do it by pasting the following code at the beginning of the Gradle build file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.1'
    }
}

将版本字符串 1.0.+ 替换为最新版本.Gradle 插件的发布版本可以在 官方 Maven 存储库MVNRepository神器搜索.

Replace version string 1.0.+ with the latest version. Released versions of Gradle plugin can be found in official Maven Repository or on MVNRepository artifact search.

这篇关于Android Studio:未找到 ID 为“android-library"的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆