3

I've created an Android library project in Android Studio and prepared the build.gradle to automate deployment to the Maven Central repository, followed the official instructions from Sonatype.

Particularly, I've added metadata according the Metadata Definition and Upload section

uploadArchives {
  repositories {
     mavenDeployer {
       beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

       //...

       pom.project {
         name 'Example Application'
         description 'A application used as an example on how to set up pushing  its components to the Central Repository.'
         url 'http://www.example.com/example-application'

         scm {
           connection 'scm:svn:http://foo.googlecode.com/svn/trunk/'
           developerConnection 'scm:svn:https://foo.googlecode.com/svn/trunk/'
           url 'http://foo.googlecode.com/svn/trunk/'
         }

         licenses {
           license {
             name 'The Apache License, Version 2.0'
             url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
           }
         }

         developers {
           developer {
             id 'manfred'
             name 'Manfred Moser'
             email 'manfred@sonatype.com'
           }
         }
       }
     }
  }
}

Android Studio shows warnings like 'name' cannot be applied to '(java.lang.String)' for the entries

  • pom.project/name,
  • pom.project/description,
  • pom.project/licenses/license/name,
  • pom.project/organization/name and
  • pom.project/developers/developer/name.

Running ./gradlew --info clean uploadArchives shows no such warnings. The generated pom.xml contains the defined metadata.

These warnings are somewhat annoying, because Android Studio intercepts every commit that includes the build.gradle to inform me about the existence of warnings.

The question: It there actually a problem with the build.gradle or is there something wrong with Android Studio's interpretation? If it is a problem with the build.gradle, how do I fix it?

toKrause
  • 512
  • 1
  • 4
  • 13
  • Could it be related to differing Gradle versions? In that case try using the wrapper like described in http://stackoverflow.com/questions/17727645/how-to-update-gradle-in-android-studio – Jocce Nilsson Mar 21 '16 at 11:40

0 Answers0