我正在尝试使用 BitBucket API 在我的私人 BitBucket 帐户中添加一个依赖项,遵循对此 SO 帖子的接受答案。
我的项目根级 build.gradle 文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://bitbucket.org/api/2.0/repositories/{user}/{repo}/commit/{tag_num}'
}
credentials {
username 'my_username'
password 'my_password'
}
}
}
我收到以下错误:
Error:(21, 0) Gradle DSL method not found: 'credentials()'
Possible causes:
- The project 'USPLibraryClerk' may be using a version of Gradle that does not contain the method.
- The build file may be missing a Gradle plugin.
如果我将credentials {}
to移到maven {}
块内,则在获取我的回购方面似乎没有任何更新。
maven {
url 'https://bitbucket.org/api/2.0/repositories/{user}/{repo}/commit/{tag_num}'
credentials {
username 'my_username'
password 'my_password'
}
}
如何修复此错误消息?