簡體   English   中英

Gradle找不到android插件的classpath

[英]Gradle can't find classpath for android plugin

我收到此錯誤,說它無法找到與Android插件相關的類路徑。 使用gradle 1.2。

這是錯誤:

Could not find method classpath() for arguments [org.gradle.api.plugins:gradle-android-plugin:1.2.1]

這是我的build.gradle文件

//setup external dependency plugins we will use to build a android application
buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
    }

    dependencies {
        classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.1'
    }
}

//apply eclipse plugin
apply plugin: 'eclipse'

//apply android plugin
apply plugin: 'android'

apply plugin: 'maven'

task hello << {
    String value = 'wagwan'
    println 'Hello world!' + value.toUpperCase()
}

謝謝

編輯:我現在收到的新錯誤:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve group:org.gradle.api.plugins, module:gradle-android-plugin, version:1.2.1.
  Required by:
      :RssUnified:unspecified
   > Could not GET 'http://repo1.maven.org/maven2/org/gradle/api/plugins/gradle-android-plugin/1.2.1/gradle-android-plugin-1.2.1.pom'.
   > Could not GET 'https://oss.sonatype.org/content/repositories/snapshots/org/gradle/api/plugins/gradle-android-plugin/1.2.1/gradle-android-plugin-1.2.1.pom'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

如指南所示, dependencies { classpath ... }塊必須在buildscript { ... }內部。 僅對於構建腳本,定義了名為classpath的配置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM