Unsupported Gradle DSL method found: 'mavenDeployer()'!

i am using Android studio and just trying to add a library to my project “Paralloid” and when i press sync project with gradle i get this error

Gradle ‘crickistan’ project refresh failed:

Build script error, unsupported Gradle DSL method found: ‘mavenDeployer()’!

Possible causes could be:

  • you are using Gradle version where the method is absent

  • you didn’t apply Gradle plugin which provides the method

    • or there is a mistake in a build script

    Build file ‘/Users/wasif/crickistan/libraries/paralloid/build.gradle’ line: 31

    : Gradle settings

We’d have to see the build script, especially around line 31.

buildscript {

repositories {

mavenCentral()

}

dependencies {

classpath ‘com.android.tools.build:gradle:0.6.+’

} } apply plugin: ‘android-library’

repositories {

mavenCentral() }

android {

compileSdkVersion 19

buildToolsVersion “19.0.0”

defaultConfig {

minSdkVersion 7

targetSdkVersion 19

} }

dependencies {

compile “com.android.support:support-v4:18.0.+” }

uploadArchives {

configuration = configurations.archives

repositories.mavenDeployer { //this is line 13

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

repository(url: sonatypeRepo) {

authentication(

userName: sonatypeUsername,

password: sonatypePassword

)

}

pom.project {

name ‘Paralloid’

artifactId = ‘paralloid’

packaging ‘aar’

description ‘Parallax library for Android’

url ‘https://github.com/chrisjenx/Paralloid

scm {

url ‘scm:git@github.com:chrisjenx/Paralloid.git’

connection ‘scm:git@github.com:chrisjenx/Paralloid.git’

developerConnection ‘scm:git@github.com:chrisjenx/Paralloid.git’

}

licenses {

license {

name ‘The Apache Software License, Version 2.0’

url ‘http://www.apache.org/licenses/LICENSE-2.0.txt

distribution ‘repo’

}

}

developers {

developer {

id ‘chrisjenx’

name ‘Christopher Jenkins’

email ‘chris.mark.jenkins@gmail.com’

}

}

}

} }

I think you’ll have to add ‘apply plugin: “maven”’ at the top of the build script.

PS: Please use HTML code tags when pasting code.

fixed but another problem now :S

Gradle 'crickistan' project refresh failed:
            No such property: sonatypeRepo for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
            Build file '/Users/wasif/crickistan/libraries/paralloid/build.gradle' line: 36
            : Gradle settings

any help??

Got the same error trying to import the same library! What’s wrong with it?

Best inspect that build or ask its author. Perhaps the build expects a ‘sonatypeRepo’ entry in ‘gradle.properties’, but I’m just guessing.

You just have to delete the whole uploadArchives() block