Android 没有这样的属性:sonatypeUserName 类:org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22714706/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No such property: sonatypeUserName for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
提问by jucajl
I'm trying to use this blibioteca android-maps-extensionsbecause I need to fix more than 1000 markers on my map .
我正在尝试使用这个 blibioteca android-maps-extensions,因为我需要在我的地图上修复 1000 多个标记。
Added the project dependencies in my project :
在我的项目中添加了项目依赖项:
compile project (':android-maps-extensions')
But when I update build.gradle get the following error :
但是当我更新 build.gradle 时出现以下错误:
No such property : for class sonatypeUserName : org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
没有这样的属性:对于类 sonatypeUserName :org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
The username and password appear to be incorrect or something , this code is part of the project I'm build.gradle matter how library:
用户名和密码似乎不正确或其他内容,此代码是我正在 build.gradle 的项目的一部分,无论库如何:
...
pom.project {
name 'Android Maps Extensions'
description 'Library extending capabilities of Google Maps Android API v2'
inceptionYear '2013'
url 'http://AndroidMapsExtensions.com'
packaging 'aar'
developers {
developer {
name 'Maciej Górski'
id 'mg6maciej'
email '[email protected]'
url 'http://mg6.pl'
}
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/mg6maciej/android-maps-extensions'
connection 'scm:git:https://github.com/mg6maciej/android-maps-extensions.git'
developerConnection 'scm:git:https://github.com/mg6maciej/android-maps-extensions.git'
}
}
...
Any suggestions ?
有什么建议 ?
回答by DeltaCap019
Open the gradle.properties
file inside the projects android-maps-utils-master
that you may have downloaded from GitHub
打开您可能从GitHub下载gradle.properties
的项目android-maps-utils-master
中的文件
You will find
你会找到
version=0.4-SNAPSHOT
# variables required to allow build.gradle to parse,
# override in ~/.gradle/gradle.properties
signing.keyId=
signing.password=
signing.secretKeyRingFile=
sonatypeUsername=
sonatypePassword=
inside it, just copy and put it in your projects gradle.properties
.
在其中,只需复制并将其放入您的项目中即可gradle.properties
。
回答by HelloWorld
modify your gradle.properties file:
修改您的 gradle.properties 文件:
#To fix compile error.
sonatypeRepo=null
sonatypeUsername=null
sonatypePassword=null
回答by Guru Surend
I believe This line shows error:
我相信这一行显示错误:
authentication(userName: ossrhUsername, password: ossrhPassword)
身份验证(用户名:ossrhUsername,密码:ossrhPassword)
Replace it with:
替换为:
authentication(userName: hasProperty('ossrhUsername')?ossrhUsername:'', password: hasProperty('ossrhPassword')?ossrhPassword:'')
authentication(userName: hasProperty('ossrhUsername')?ossrhUsername:'', password: hasProperty('ossrhPassword')?ossrhPassword:'')
回答by MaciejGórski
When using gradle, you don't normally copy the project into your own, but instead just add dependency like this:
使用 gradle 时,您通常不会将项目复制到您自己的项目中,而只是添加如下依赖项:
dependencies {
// your other dependencies
compile 'com.androidmapsextensions:android-maps-extensions:2.1.+';
compile 'com.google.android.gms:play-services:4.1.+'
}
To see the latest versions of libraries, you may use Gradle, please.
要查看最新版本的库,您可以使用Gradle,请。
But if you want to use the project directly, you also need to have gradle.propertieswith variables defined:
但是如果你想直接使用项目,你还需要有gradle.properties并定义了变量:
sonatypeUserName=
sonatypePassword=
回答by tehcpu
Also, if other suggestions didn't fix the problem, you can try to re-write your lib's build.gradle
as usual build.gradle
file. More likely its not a good idea, but it worked for me properly:
此外,如果其他建议没有解决问题,您可以尝试build.gradle
像往常一样重新编写 libbuild.gradle
文件。更有可能这不是一个好主意,但它对我有用:
apply plugin: 'android'
version = "1.0.1"
group = "com.edmodo"
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 7
targetSdkVersion 21
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
回答by mboy
I encountered the same error
我遇到了同样的错误
No such property : for class sonatypeUserName : org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
没有这样的属性:对于类 sonatypeUserName :org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
What I did to fix the problem was I just copy pasted 'sonatypeUserName' in the gradle.properties
我为解决这个问题所做的只是将“sonatypeUserName”复制粘贴到 gradle.properties