Andrii Chernysh
Andrii Chernysh

Reputation: 375

Can't add android library to JCenter

I am trying to publish the library to JCenter with Bintray, according to this article: https://medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter-59e6030c8890.

I successfully added the library to Bintray, but when I click on "Add to JCenter" button and send compose message - I am getting an error:

Failed to send a message: Package should include sources as part of the package.

Please, tell me what am I doing wrong?

Upvotes: 5

Views: 934

Answers (2)

asmsuechan
asmsuechan

Reputation: 1

For developers who reach here today, make sure your configuration file has artifact(sourcesJar.get()) in publishing{} like these lines below (not complete build.gradle.kts).

val sourcesJar by tasks.registering(Jar::class) {
    classifier = "sources"
    from(sourceSets.main.get().allSource)
}

publishing {
  publications {
    create<MavenPublication>("default") {
      from(components["java"])
        artifact(dokkaJar)
    }
  }

  publications.invoke {
    publicationName(MavenPublication::class) {
      artifactId = artifactID
      artifact(sourcesJar.get()) // This line
    }
  }
}

Upvotes: 0

Royg
Royg

Reputation: 1685

Your Bintray Maven Package doesn't contain the sources, only .aar and the .pom. The in the blog post isn't linked to JCenter, see blog's package here.

Bintray's wiki states that you have to include the sources.

I would use this blog post or this one, where the packages are actually linked to JCenter.

Upvotes: 4

Related Questions