Closed lsuski closed 7 years ago
@lsuski How did you work around this issue? I came here from dcendents/android-maven-gradle-plugin#64.
For future reference, I added maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
to my buildscript repositories and then updated to 3.3.1-SNAPSHOT
where the bug is fixed.
3.1.1 has been released.
Having 2 separate publications for debug
and release
has some drawback - it performs 2 separate uploads to maven repository (for Maven they are separate versions so for SNAPSHOT it increment version counter) but I wanted to have single upload with artifacts: my-lib-debug.aar and my-lib-release.aar.
To workaround this I have this in build.gradle
publishing.publications {
"mavenAll"(MavenPublication) {
def addAll=true
pom.packaging = 'aar'
android.libraryVariants.all { v ->
if (addAll) {
addAll=false
from components.android // this can be called only once
setArtifacts([]) //clears artifact added by components.android - my-lib.aar
artifact(tasks.sourcesJar) //add sources my-lib-sources.jar - optional
}
artifact(tasks."bundle${v.name.capitalize()}") { // add aar artifact my-lib-<variant>.aar
classifier v.name
}
}
}
}
@lsuski Unfortunately, that prevents your variants from having different dependencies because Maven can only have one pom.xml
file per version per artifact ID. The way Google Guava separates their JVM and Android builds is by appending it to the end of the version: guava:23.3-android
or guava:23.3-jvm
.
Yeah, I know that but in this case I have the same dependencies.
@lsuski Okay, I'm just clarifying and bringing up all of the options for any other people looking for a solution here.
I have this exception when trying to use components.androidDebug or components.androidRelease with Gradle 4.2.1 and AGP 3.0.0