我得到這個錯誤,說它找不到與android插件相關的類路徑。使用gradle 1.2。Gradle無法找到Android插件的類路徑
這裏是錯誤:
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.
我在編輯時沒有看到上面提到的錯誤信息。該插件可以成功下載。我使用Gradle 1.2運行相同的代碼。 –
我認爲我的cmd提示符在工作時沒有使用正確的Internet代理。任何想法如何我可以更改在Windows 7中用於cmd.exe的互聯網代理? – jonney
您可以在'gradle.properties'中爲[Gradle建立一個HTTP代理](http://www.gradle.org/docs/current/userguide/build_environment.html)。 –