Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to publish android library to Jfrog bintray?

I am working on Android library development, i have already finished my library work and generated aar and jar file, but when i am trying to publish to binary at that time i am getting one error message.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mylittlelibrary:bintrayUpload'.
> Could not create package 'abcd/maven/helloaar.example.com.mylittlelibrary': HTTP/1.1 404 Not Found [message:Repo 'maven' was not found]

* Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.391 secs
Could not create package 'abcd/maven/helloaar.example.com.mylittlelibrary': HTTP/1.1 404 Not    Found [message:Repo 'maven' was not found]
2:41:59 AM: External task execution finished 'bintrayUpload'.

build.gradle

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

repositories {
   mavenCentral()
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
    minSdkVersion 17
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

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

 group = 'helloaar.example.com.mylittlelibrary'
 version = '1.0.2'

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

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

 task generateJavaDocsJar(type: Jar) {
     from generateJavaDocs.destinationDir
     classifier 'javadoc'
 }
 generateJavaDocsJar.dependsOn generateJavaDocs

bintray {
    user = 'abcd'
    key = '1234567890fghgfhffjfgjfjfjrtyjtkjg'
    pkg {
       repo = 'maven'
       name = 'helloaar.example.com.mylittlelibrary'

    version {
        name = '1.0.2'
        desc = 'My test upload'
        released  = new Date()
        vcsTag = '1.0.2'
    }

    licenses = ['Apache-2.0']
    vcsUrl = ''
    websiteUrl = ''
}
configurations = ['archives']
}

artifacts {
   archives generateJavaDocsJar
   archives generateSourcesJar
}

enter image description here

Please kindly go through my script and suggest me some solution.

like image 934
deeptimancode Avatar asked Sep 08 '16 21:09

deeptimancode


1 Answers

Before you publish to Bintray you must have a stable build of your code. The hierarchy on Bintray is the following: User --> Repo --> package --> version --> artifact means that the Repo should be above the package by that hierarchy.

The following lines in your gradle.build are probably the main cause for the error:

pkg {
    repo = 'maven'
    name = 'helloaar.example.com.mylittlelibrary'
}

The hierarchy is wrong.

When using maven you should check that you comply with the maven convention, else the Maven Build can not succeed. Explanation for Maven Repositories on Bintray.

The error you had:

HTTP/1.1 404 Not Found [message:Repo 'maven' was not found] 

Means that you do not have a Repository on Bintray calls maven. All the packages versions and files should be under the Bintray Repository you have created.

For more details or support issues you can use the Bintray support team which is available for all Bintray users and can help you with any problem related to any JFrog platform services such as Bintray, Artifactory, Mission control & Xray.

like image 188
Rotem Avatar answered Nov 08 '22 14:11

Rotem