Search code examples
androidmavengradleandroid-gradle-pluginjcenter

Some problems were found with the configuration of task ':app:bintrayUpload' when trying to upload an Android Library to jCenter


I am trying to upload my library to jCenter. I am following this tutorial:

http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en

After following the steps and getting to typing in the Android terminal "> gradlew bintrayUpload" I get the following error:

:app:bintrayUpload FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Some problems were found with the configuration of task ':app:bintrayUpload'.

    No value has been specified for property 'packageName'. No value has been specified for property 'user'. No value has been specified for property 'apiKey'. No value has been specified for property 'repoName'.

Before flagging my question as a duplicate, I shall indicate that i tried the solutions from the following stackoverflow questions:

Publications(s) specified but no publications exist in project :library

After trying that solution, I get the following error:

FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'bintrayUpload' not found in root project 'UniFont'.

Searching this error, I got to the following solution from this question on stackoverflow: Task 'bintrayUpload' not found in root project 'bin'

That was not the solution for me. My path with jdk/jre exists. I have tried switching between them multiple times. Optional question:

Do I need to declare both JDK and JRE paths into Windows Envirorment Variables?

Here is my top level 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.2.3'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
    classpath 'com.github.dcendents:android-maven-plugin:1.2'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
}

allprojects {

//apply plugin: 'com.jfrog.bintray'

repositories {
    jcenter()
    }
}

Here is my build.gradle(app module):

apply plugin: 'com.android.library'

android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"

defaultConfig {
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {

    }
}

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

ext {
    bintrayRepo = 'maven'
    bintrayName = 'Library Name'

publishedGroupId = '...'
libraryName = '...'
artifact = '...'

libraryDescription = 'A simple library for setting a single font in a View in Android.'

siteUrl = '...'
gitUrl = '...'

libraryVersion = '1.0'

developerId = '...'
developerName = '...'
developerEmail = '...'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

Can anyone please help me with this?

Thanks you!


Solution

  • Here is a simple tutorial for uploading your libraries to bintray.

    Your build.gradle file of project should be something like this.

    buildscript {
     //...
        dependencies {
            classpath 'com.android.tools.build:gradle:1.2.3'
            classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
            classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
            classpath 'com.github.dcendents:android-maven-plugin:1.2'
            }
    }
        //...    
    }
    

    And add these lines at the end of build.gradle file of your desired module which you want to upload to jcenter

    ext {
        developerId = 'your username in bintray'
        developerName = 'your name'
        developerEmail = 'your email'
        bintrayRepo = 'maven'
        bintrayName = 'your library name in bintray'
    
        publishedGroupId = 'your group id'
        libraryName = 'your library name(better to be as like as bintrayName)'
    
        artifact = 'your artifact'
    
        libraryDescription = 'description'
        libraryVersion = 'version'
    
    }
    apply from: 'https://raw.githubusercontent.com/smasoumi/Bintray/master/install.gradle'
    apply from: 'https://raw.githubusercontent.com/smasoumi/Bintray/master/bintray.gradle'
    

    And also add your apiKey and username of bintray to your local.properties and change your gradle version to 2.2.1

    Then execute

    gradlew.bat install
    

    If it shows successful message then upload your project to bintray by this command

    gradlew.bat bintrayUpload
    

    Also be sure that JDK path is set.