Search code examples
androidgradleandroid-gradle-pluginbintrayjcenter

Publishing a library using jfrog.bintray HTTP/1.1 404 Not Found [message:Repo '' was not found]


I've been twisting my head around this issue for far too long today, can't seem to figure out what's wrong with this setup. I've followed this tutorial in order to be able to upload an android library to bintray (and later add it to jcenter). Here are the relevant files:

Project level build.gradle:

buildscript {
    ext.kotlin_version = '1.3.20'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
        classpath "com.github.dcendents:android-maven-gradle-plugin:2.1"
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Library level build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

ext{

    bintrayRepo = "FlexibleRecyclerView"
    bintrayName = "com.tornelas.flexiblerecyclerview"

    libraryName = "flexiblerecyclerview"

    //artifact
    publishedGroupId = 'com.tornelas.flexiblerecyclerview'
    artifact = 'flexiblerecyclerview'
    libraryVersion = '0.1'

    libraryDescription = 'A recycler view where you can set the number of columns/rows and orientation on the .xml file instead of setting it on the layout manager.'
    siteUrl = ''
    gitUrl = ''
    developerId = 'tornelas'
    developerName = 'Tiago Ornelas'
    developerEmail = ''
    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.text'
    allLicenses = ['Apache-2.0']
}

android {
    compileSdkVersion 28

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "0.1"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
}

if(project.rootProject.file('local.properties').exists()){
    apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
    apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
}

(I've omitted siteUrl, gitUrl and developerEmail for privacy reasons)

On the bintray dashboard: http://snpy.in/UwPAv5

When I run 'bintrayUpload' I get the following:

1: Task failed with an exception.
Execution failed for task ':flexiblerecyclerview:bintrayUpload'.
> Could not create package 'tornelas/FlexibleRecyclerView/com.tornelas.flexiblerecyclerview': HTTP/1.1 404 Not Found [message:Repo 'FlexibleRecyclerView' was not found]

2: Task failed with an exception.
Execution failed for task ':bintrayPublish'.
> Could not sign version '0.1': HTTP/1.1 404 Not Found [message:Repo 'FlexibleRecyclerView' was not found]

I was wondering if this issue was occurring because this library "FlexibleRecyclerView" is part of an organization (called "Frontkom"). But I couldn't get my head around a solution for this.

I'm sure the credentials on local.properties are correct as I already authenticated using their REST API with them.

Many thanks in advance!


Solution

  • So, the issue was that I was trying to publish to a repository that belonged to my organization (even though I'm the owner of that organization) and I'm unable to create repos outside that organization. For that reason, just by adding

    bintray {
        pkg {
            userOrg = 'myorganizationname'
        }
    }
    

    to my module's build.gradle right after the ext{} I was able to upload this successfully.