I upgraded my kotlin and android gradle plugin versions as follows
kotlin version: 1.9.0
android gradle version: 8.4
build.gradle.kts(project)
plugins {
`kotlin-dsl`
`maven-publish`
id("com.android.application") version "8.3.0" apply false
id("com.android.library") version "8.3.0" apply false
id ("org.jetbrains.kotlin.android") version "1.9.0" apply false
}
buildscript{
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20")
classpath("com.android.tools.build:gradle:8.2.2")
}
}
gradle.wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-8.4-bin.zip
build.gradle.kts(sdk)
plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-parcelize")
id("kotlin-kapt")
id("maven-publish")
}
android {
...
}
tasks.register("sourcesJar", Jar::class) {
archiveClassifier.set("sources")
from(android.sourceSets["main"].java.srcDirs) {
include("xxx/builder/**")
}
}
afterEvaluate {
publishing {
publications {
create<MavenPublication>("xxx-saas-sdk") {
from(components["prodRelease"])
groupId = "com.myProject
artifactId = "saas"
version = "1.0.0"
pom {
name.set("MyProjectSaaSSDK")
}
artifact(tasks["sourcesJar"])
repositories {
mavenLocal()
}
}
}
}
}
dependencies {
....
}
I searched on the internet but I couldn’t implemented them to my project because I couldn’t understand how to implement to my project.
I cannot access sdk library classes or something when I remove artifact(tasks["sourcesJar"])
from build.gradle.kts (sdk)