Gradle 未找到 DSL 方法:'credentials()'
Gradle DSL method not found: 'credentials()'
我正在尝试使用 BitBucket API 从我的私人 BitBucket 帐户添加依赖项,遵循 .
的已接受答案
我的项目根目录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 {}
移动到 maven {}
块内,在获取我的回购方面似乎没有任何更新。
maven {
url 'https://bitbucket.org/api/2.0/repositories/{user}/{repo}/commit/{tag_num}'
credentials {
username 'my_username'
password 'my_password'
}
}
如何修复此错误消息?
你可以这样使用:
repositories {
jcenter()
maven {
credentials {
username 'xxxx'
password 'xxxx'
}
url 'http://xxxxxxxx/repositories/releases/'
}
}
这里是official doc.
我正在尝试使用 BitBucket API 从我的私人 BitBucket 帐户添加依赖项,遵循
我的项目根目录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 {}
移动到 maven {}
块内,在获取我的回购方面似乎没有任何更新。
maven {
url 'https://bitbucket.org/api/2.0/repositories/{user}/{repo}/commit/{tag_num}'
credentials {
username 'my_username'
password 'my_password'
}
}
如何修复此错误消息?
你可以这样使用:
repositories {
jcenter()
maven {
credentials {
username 'xxxx'
password 'xxxx'
}
url 'http://xxxxxxxx/repositories/releases/'
}
}
这里是official doc.