'android module gradle shadow a dependency
I am trying to create a android module with some dependency shadowjar in to new package name and upload it to nexus repo.
but the shadow process is not working as expected.
downloaded and decompiled .aar and .jar file and found no relocate is happened.
plugins {
id "com.github.johnrengelman.shadow" version "5.2.0"
}
repositories {
mavenCentral()
google()
maven {
url 'https://maven.fabric.io/public'
}
maven { url 'https://maven.google.com' }
jcenter()
maven { url "https://jitpack.io" }
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
repository(url: "https://maven.myrepos-site.com/repository/shadowpkg/") {
authentication(userName: "uname", password: "pwd")
pom.groupId = "com.mypkg"
pom.artifactId = "myapp"
pom.version = '1.0.1'
}
}
}
}
android {
compileSdkVersion 30
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
.....
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
.....
implementation "com.microsoft.appcenter:appcenter-analytics:3.0.0"
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task someJar(type: ShadowJar) {
println "shadowjar - somejar"
relocate 'com.microsoft.appcenter', 'com.shadowpkg.appcenter'
}
defaultTasks 'build', 'someJar'
Is it possible like this way or I have to ask clients to exclude the given library while adding if there is any dependency conflicts like below.
implementation ('com.mypkg:myapp:1.0.0') {
exclude group: 'com.microsoft.appcenter', module: 'appcenter-analytics'
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
