ceessay
ceessay

Reputation: 332

Building an android library in Jitpack: ERROR: No build artifacts found

I've forked an Android library and merge some changes that I need https://github.com/ceessay/kdgaugeView

In order to use the library in my Android project I've tried publishing it on Jitpack.

The problem is after pushing changes on Github, the builds on Jitpack seem to pass but there's this message

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 543ms
4 actionable tasks: 1 executed, 3 up-to-date
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
2020-07-13T12:27:13.425592193Z
Exit code: 0
ERROR: No build artifacts found

full log here: https://jitpack.io/com/github/ceessay/kdgaugeView/1.0.5/build.log

Adding the library in my project also failes with the following message:

Could not find com.github.ceessay:kdgaugeView:1.0.4.

I've followed the guidelines on Jitpack documentation, Upgraded gradle on the library but i wont work.

I am new to publishing libraries for Android so I might be missing something. Any clue of what that is ?

Upvotes: 2

Views: 1758

Answers (3)

Shubham Pandey
Shubham Pandey

Reputation: 219

After digging a lot final got a solution that is better first i will suggest to go with documentation that will help you far better than anything here is the link. : https://developer.android.com/build/publish-library/upload-library

In plugin at top add

plugins {
    alias(libs.plugins.android.library)
    alias(libs.plugins.jetbrains.kotlin.android)
    `maven-publish`
}

In you gradle you have to add

android {
  publishing {
        singleVariant("release") {
            withSourcesJar()
        }
    }
}

Below the android column add


group = "com.papayacoders.draw"
version = "1.0.9"


publishing {
    publications {
        create<MavenPublication>("release") {
            
            afterEvaluate {
                from(components["release"])
            }
            
            groupId = "com.papayacoders.draw"
            artifactId = "AndroidDraw"
            version = "1.0.9" // Ensure this matches your versioning

        }
    }
}

Upvotes: 1

Sean
Sean

Reputation: 3035

You can use the maven-publish gradle plugin. The documentation for maven-publish is https://developer.android.com/studio/build/maven-publish-plugin.

I'm sure it's also possible to use com.github.dcendents.android-maven which is already in that project, but it isn't as obvious to me.

You can also check out the excellent plugin https://vanniktech.github.io/gradle-maven-publish-plugin/.

Upvotes: 1

trashkalmar
trashkalmar

Reputation: 883

Spent half a day fighting the same problem. I forgot to define publication for my artifact in build.gradle.kts:

publishing {
  publications {
    create<MavenPublication>("maven") {
      groupId = "com.github.username"
      artifactId = "library-name"
      version = "1.0.0"

      from(components["kotlin"])
    }
  }
}

Hope, this helps.

Upvotes: 0

Related Questions