Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building android project with gradle

Tags:

android

gradle

Im trying to build a simple android app using gradle build tools. but im getting an error like this

No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (java.lang.String) values: [org.gradle.api.plugins:gradle-android-plugin:1.2.0-SNAPSHOT] Possible solutions: module(java.lang.Object)

ang here's a simple configuration of build.gradle

buildscript {
 repositories {
     mavenCentral()
  }
  dependencies {
    compile 'org.gradle.api.plugins:gradle-android-plugin:1.2.0-SNAPSHOT'
  }
}


apply plugin: 'android'

repositories {
   mavenCentral()
} 


processResource {
    expand (project.properties)
}

task configureDebug << {
    jar.classifier = "debug"
}

task configureRelease << {
    proguard.enabled = true
}
like image 661
oczdref Avatar asked Mar 26 '26 02:03

oczdref


2 Answers

When applying a plugin you want tell you build script to use it in its classpath. It is not required for compilation so just change the configuration compile to classpath. More more information see 51.5.1. Using your plugin in another project in the Gradle user guide.

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.gradle.api.plugins:gradle-android-plugin:1.2.0-SNAPSHOT'
    }
}

EDIT: At the moment the plugin does not support r20 of the Android SDK. For more information see this issue.

like image 137
Benjamin Muschko Avatar answered Mar 28 '26 15:03

Benjamin Muschko


Make sure you are writing the dependency block on your application build.gradle "YourProjectName->yourprojectname->build.gradle" in android studio hierarchy .

like image 39
banty Avatar answered Mar 28 '26 16:03

banty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!