- Library is not getting published in a jetpack and leads to an error when I am trying with kotlin-Dsl.
- Is there any code I am missing?
Repo-Link: https://jitpack.io/#devrath/DroidUtilToolBox/1.4.0
Github-Project: https://github.com/devrath/DroidUtilToolBox
Error Log:
Build starting...
Start: Tue Dec 26 07:40:11 UTC 2023 a85e66e73dc0
Git:
1.4.0-0-g7ecbace
commit 7ecbacebde8c6805b497555f8a2faff00b7edc42
Author: Devrath
Date: Tue Dec 26 13:09:08 2023 +0530
test
Init SDKMan
Found Android manifest
Android SDK version: . Build tools:
Android SDK version: . Build tools:
1/1: License android-sdk-preview-license:
dirname: missing operand
Try 'dirname --help' for more information.
LIBDIR=
Android project not found. Looking for AndroidManifest.xml and project.properties.
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
2023-12-26T07:40:18.659047103Z
Exit code: 0
⚠️ ERROR: No build artifacts found
Build.gradle.kts
plugins {
id("com.android.library")
kotlin("android")
kotlin("kapt")
id("maven-publish")
}
android {
namespace = "com.istudio.lib_utils"
compileSdk = 33
defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
afterEvaluate {
publishing {
publications {
create<MavenPublication>("release") {
//from(components.findByName("release"))
from(components["release"])
groupId = "devrath"
artifactId = "DroidUtilToolBox"
version = "1.4.0"
//artifact("$buildDir/outputs/aar/${project.name}-release.aar")
}
}
// Add the following block for configuring the repository
repositories {
maven {
name = "jitpack"
url = uri("https://jitpack.io")
}
}
}
}
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
//implementation("androidx.startup:startup-runtime:1.1.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
Your error log indicates that JitPack is unable to find the Android project and build artifacts. That could be due to a misconfiguration in your publishing setup or an issue with the Android project detection by JitPack.
But I see that the artifact is commented:
Try first to modify your
build.gradle.ktsfile, and restore that line in the publishing section:That would make sure the AAR file is explicitly included as an artifact in the publication.
Since the
build.gradle.ktsdoes now have apublication / artifactsection, here are a few debug ideas:Make sure the
AndroidManifest.xmlis correctly located in thesrc/maindirectory of the library module. And verify the structure of your library module to make sure it conforms to standard Android library project layouts.Confirm also that your project includes a Gradle Wrapper. JitPack uses the Gradle Wrapper (
gradlew) included in your repository to build the project.Examine the JitPack build log for any clues. Specifically, look for errors or warnings that occur before the "No build artifacts found" message.
If your project requires a specific build setup, consider adding a
jitpack.ymlfile at the root of your repository to customize the JitPack build environment.Try building the AAR locally using the same command JitPack would use (
./gradlew assembleRelease). That will help verify that the AAR file is being generated correctly on your local machine.Make sure the version tag (
1.8.0) in your Git repository matches the version specified in thebuild.gradle.ktsfile. JitPack relies on Git tags for versioning.Check your GitHub repository settings to make sure there are no restrictions that might be affecting JitPack's access to your repository.