Reputation: 2681
I have created simple android eclipse project. Then I added build.gradle file.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
task listJars << {
configurations.compile.each { File file -> println file.path }
}
apply plugin: 'android'
android {
compileSdkVersion 17
buildToolsVersion '17'
repositories {
mavenCentral()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
instrumentTest {
java.srcDirs = ['tests/src']
res.srcDirs = ['tests/res']
assets.srcDirs = ['tests/assets']
resources.srcDirs = ['tests/src']
}
}
dependencies {
compile 'org.roboguice:roboguice:2.0'
compile fileTree(dir: 'libs', include: '*.jar')
}
}
As you can see, I want to use RoboGuice from maven. Gradle downloads it, but does not add to the lib folder for eclipse. So I cannot use it in eclipse when writing code. Do I need to manually copy them over? I added a task to display them:
$ gradle -q listJars
/Users/xxx/Documents/codepath2/SampleAndroidGradle/libs/android-support-v4.jar
/Users/xxx/.gradle/caches/artifacts-24/filestore/org.roboguice/roboguice/2.0/jar/727ccb8f376109d0b5c44abca6f791dccc5c5dbc/roboguice-2.0.jar
/Users/xxx/.gradle/caches/artifacts-24/filestore/javax.inject/javax.inject/1/jar/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar
/Users/xxx/.gradle/caches/artifacts-24/filestore/aopalliance/aopalliance/1.0/jar/235ba8b489512805ac13a8f9ea77a1ca5ebe3e8/aopalliance-1.0.jar
/Users/xxx/.gradle/caches/artifacts-24/filestore/asm/asm/3.1/jar/c157def142714c544bdea2e6144645702adf7097/asm-3.1.jar
/Users/xxx/.gradle/caches/artifacts-24/filestore/org.sonatype.sisu.inject/cglib/2.2.1-v20090111/jar/7ce5e983fd0e6c78346f4c9cbfa39d83049dda2/cglib-2.2.1-v20090111.jar
/Users/xxx/.gradle/caches/artifacts-24/filestore/com.google.inject/guice/3.0/jar/28586dc97c525501329d9a242fc3402041e3572d/guice-3.0-no_aop.jar
Upvotes: 2
Views: 2903
Reputation: 236
The following post includes two Groovy fragments which can be added to build.gradle
. Either of them makes gradle dependencies available to Eclipse.
See Add dependencies via gradle to eclipse in android project
Upvotes: 1
Reputation: 1669
That is correct. Gradle won't put the jars in the lib directory. The assumption is that your lib directory is for manual changing jars. You can probably create a Gradle task to copy them to your lib directory if thats what oyu want to do.
I don't think there is official support for gradle in eclipse, and if you're just starting out a new project, consider using Android Studio (http://developer.android.com/sdk/installing/studio.html)
Upvotes: 3