Simon
Simon

Reputation: 147

why bintrayUpload Could not create version '0.1' ? HTTP/1.1 401 Unauthorized

what is problem with my version ?

bintray.gradle

apply plugin: 'com.jfrog.bintray'

version = '0.1'

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}
artifacts {
    archives javadocJar
    archives sourcesJar
}

bintray{
    user = 'user_name'
    key = 'apikey'

    configurations = ['archives']
    pkg {
        repo = 'maven'
        name = 'notification-handler'
        desc = 'first initiate'
        websiteUrl = 'myWebsiteUrl'
        vcsUrl = 'MyVcsUrl'
        licenses = ["Apache-2.0"]
        publish = true
        publicDownloadNumbers = true
    }
}

Error

Information:Gradle tasks [bintrayUpload]

Error:Execution failed for task ':parham-notification-handler:bintrayUpload'.

Could not create version '0.1': HTTP/1.1 401 Unauthorized [message:This resource requires authentication]

Information:BUILD FAILED

Thanks.

Upvotes: 3

Views: 874

Answers (3)

Mahdi-Malv
Mahdi-Malv

Reputation: 19220

In my case (that I used local.properites), I had declared variable values as strings (in quotes).

bintray.user='user'
bintray.apikey='sdasasfsrefsfercfsfV'

Which is not correct. So I remoted the quotes.

bintray.user=user
bintray.apikey=sdasasfsre

Upvotes: 0

Niv Apel
Niv Apel

Reputation: 406

Try change bintray.user and bintray.key to these lines:

user  = property('user')
key   = property('key')

After run the following command:

gradle -Puser=YOUR_BINTRAY_USERNAME -Pkey=YOUR_BINTRAY_API_KEY bintrayUpload --info

You can get your Bintray API_KEY through the edit bintray profile page under "API Key" tab

enter image description here

Upvotes: 10

ROBOHORSE
ROBOHORSE

Reputation: 11

Use this tutorial and this configuration as example. "bintray.user" and "bintray.apikey" located in local.properties file

Upvotes: 0

Related Questions