Reputation: 2660
I am developing an android project by using actionbrsherlock library. after adding the actionbarsherlock library in android studio , my directory structure is
MYAPPLICATION
- app
- gradle
- libraries
- actionbarsherlock (library project)
build.gradle
setting.gradle
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
compile project(":libraries:actionbarsherlock")
}
}
allprojects {
repositories {
mavenCentral()
}
}
setting.build
include ':app'
include ':libraries:actionbarsherlock'
after running following error occured,
A problem occurred evaluating root project 'MyApplication'. > No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (org.gradle.api.internal.project.DefaultProject_Decorated) values: [project ':libraries:actionbarsherlock'] Possible solutions: module(java.lang.Object)
I upgraded my android studio to 0.4.4. and change the build.gradle file. one can find the whole setup on github https://github.com/manishpathak99/AndroidStudio.
Upvotes: 0
Views: 550
Reputation: 25858
First I will strongly recommend you to upgrade your studio to version 0.4.3 because there were some dependencies related issues in 0.4.2 release .
Answer :
You are adding module dependencies at wrong place in build.gradle file . Your module's build.gradle file should look like this :
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
// Your all module dependencies should be defined here
compile project(":libraries:actionbarsherlock")
}
Recommended Solution :
ActionbarSherlock library has its maven dependency, In such cases no need to download the whole library and add it as as module in your project, instead add the maven gradle dependency in your module's build.gradle file like
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock-i18n:4.4.0@aar'
}
That's it.
Upvotes: 2