I followed instruction from http://developer.android.com/tools/support-library/setup.html to add the support library to my android project, but got an build error like this
Gradle: A problem occurred evaluating project ':projectname'.
No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (java.lang.String) values: [com.android.support:appcompat-v7:18.0.+] Possible solutions: module(java.lang.Object)
Does anyone know the reason for that? Is it a syntax error in gradle? Below is a piece of code in my build.gradle.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
compile 'com.android.support:appcompat-v7:18.0.+'
}
}
This should be like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
// this is for Gradle build system so it finds
// android plugin used below
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:appcompat-v7:18.0.+'
// this is for your application
}
Don't forget to install Android Support Repository in Android SDK Manager.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With