InvalidUserDataException publishing to maven when minSdkVersion < 21

(Jeff Verdegan) #1

I have atask, which has been working fine to install to my local .m2/ repo. However, if I reduce the minSdkVersion below 21, it fails with the error below. I’m a total noob in gradle land, so I don’t know how changing the minSdkVersion for my Android project should break a maven task. (I’m guessing some weird transitive dependency conflict on a support lib mabye?) I also get the same error with a similar task that effects a mvn deploy to our onsite repo–works for minSdkVersion 21, but not less

I should also note that it took a long time to find a way to get maven publishing to work at all. All the various simpler approaches I found in the gradle docs didn’t work for me, or assumed a different maven setup than I have. If there’s a better way to publish to both local .m2/ and to our onsite maven repo (using scp or possibly sftp or http(s)) I’m all for it.

I didn’t want to clutter things up pasting in my whole build.gradle, but if you need to see more, let me know.


task mvnInstall(type: Upload) {
dependsOn 'assembleRelease'
description = "Installs the artifacts to the local .m2 file repo."
configuration = configurations['archives']
repositories.mavenDeployer {
        repository(url: repositories.mavenLocal().url) {
        pom.groupId = group
        pom.artifactId = artifactId
        pom.version = version
        authentication(userName: "...", password: "...")

Gradle 3.5

Build time:   2017-04-10 13:37:25 UTC
Revision:     b762622a185d59ce0cfc9cbc6ab5dd22469e18a6

Groovy:       2.4.10
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_131 (Oracle Corporation 25.131-b11)
OS:           Windows 10 10.0 amd64

    Caused by: org.gradle.api.InvalidUserDataException: The configuration to scope mapping is not unique. The following configurations have the same priority: [org.gradle.api.artifacts.maven.Conf2ScopeMapping@5333010f, org.gradle.api.artifacts.maven.Conf2ScopeMapping@534098df]
  at org.gradle.api.publication.maven.internal.pom.DefaultConf2ScopeMappingContainer.getMapping(
  at org.gradle.api.publication.maven.internal.pom.DefaultPomDependenciesConverter.createDependencyToScopeMap(
  at org.gradle.api.publication.maven.internal.pom.DefaultPomDependenciesConverter.convert(
  at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.getGeneratedDependencies(
  at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.getEffectivePom(
  at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom.writeTo(
  at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom$1.execute(
  at org.gradle.api.publication.maven.internal.pom.DefaultMavenPom$1.execute(
  at org.gradle.internal.IoActions$TextFileWriterIoAction.execute(

(Gaston Sanguinetti) #2

Have you solve this?? I have the same problem

(Paul Peavyhouse) #3

My guess is you are using MultiDex.
See here:

In the past I was able to ignore this error by not MultiDexing my app.
My app has now reached the complexity that I have to MultiDex it.
Half a year later I am still looking for a solution. :confused:

(Sahitya) #4

Try this updated version of standard maven plugin for android