Reputation: 8515
I am a complete noob with Gradle. I am writing an android application using Android Studio with a co-worker who is using Eclipse. we are sharing our files through git. It was created in eclipse without Gradle. My question is, is it possible to generate the gradle files for the project on my end without him having to export the project on his? I am trying to setup ActionBar Sherlock and its causing me all sorts of trouble I think the lack of a grable.build file might have something to do with it.
Upvotes: 1
Views: 2067
Reputation: 365008
You can include abs in your project as a library.
Put a build.gradle in abs module:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+' // You can use also classpath 'com.android.tools.build:gradle:0.6.+' with gradle 1.8
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
android {
compileSdkVersion 18
buildToolsVersion "18.0.1" //use your build version
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
Then in your project module add in build.gradle:
dependencies {
compile project(':libraries:actionbarsherlock') //Use your name
}
You have to setting also setting.gradle
include ':MyApplication'
include ':libraries:actionbarsherlock'
You can see this post: http://gmariotti.blogspot.it/2013/06/quick-tips-convert-to-new-gradle-based.html
Otherwise, you can ignore the library folder and only use in your project module this script in build.gradle.
Gradle will download from maven the aar format.
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}
Upvotes: 1
Reputation: 7652
All you need is a simple build.gradle file for your ActionBarSherlock project. Here's one I've created:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
buildToolsVersion "17.0"
compileSdkVersion 17
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
Upvotes: 0