How to publish android library to Jfrog bintray?
Asked Answered
D

2

6

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.

Dorman answered 8/9, 2016 at 21:25 Comment(4)
Do you have a repo named maven under your account?Wipe
hey thanks issue solved...i created a name under my maven accountDorman
@DeeptimanPattnaik - i can only create organisation in my account and then create a repo. I did that and it din't help me. Any help?Cerussite
Step by step instructions: stackoverflow.com/a/43951025Monday
J
2

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.

Junoesque answered 25/9, 2016 at 21:51 Comment(0)
P
0
pkg {
    repo = 'maven'
    name = 'helloaar.example.com.mylittlelibrary'

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

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'.

'abcd/maven/helloaar.example.com.mylittlelibrary'

  • abcd : bintray user name
  • maven : pkg { repo = 'maven' } set by you, example 'abcd/android-lib/helloaar.example.com.mylittlelibrary' when set repo = 'android-lib'
  • helloaar.example.com.mylittlelibrary : pkg{ name = 'helloaar.example.com.mylittlelibrary'

-

  • first : check your bintray account,
  • second : make repository,
  • third : modify your pkg repo = 'input making repository name from second step' build.gradle
  • last : build again

i hope help for you, have a nice day

Picasso answered 15/9, 2017 at 2:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.