0

I am trying to import a project in Android Studio and I am very new to this ide. So, I created some Libraries folder, copied inside the file and then added one line (the last one) to to my build.gradle :

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
    compile 'com.android.support:support-v4:13.0.+'
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    compile ":libraries:library"
} 

Edit :

I added some settings.gradle file with include ":libraries:library"

When I launch the gradle build I get

    A problem occurred configuring root project 'NewsFeeder'.
Total time: 6.507 secs
> Configuration with name 'default' not found.

Here's a screen of my tree. Is the problem related to the pom.xml file inside the IconicDroid-master plugin

enter image description here

user1611830
  • 4,749
  • 10
  • 52
  • 89

1 Answers1

0

The basic problem is that you need to have a settings.gradle file that tells Gradle where to find the library; it's not enough to put a path spec in your build.gradle file. However, I would recommend refactoring your project into a multimodule structure:

ProjectFolder
   +- NewsFeeder
   |  +-src
   |  +-res
   |  +-build.gradle
   +- iconicDroid-master
   |  +-src
   |  +-build.gradle
   +-settings.gradle
   +-build.gradle

Your settings.gradle file will look like this:

include ':NewsFeeder'
include ':iconicDroid-master'

You will need to set up a Gradle build file for your iconicDroid library; I wouldn't recommend trying to mix Gradle and Maven builders in the same project.

After you modify build.gradle or settings.gradle files, click the Sync Project with Gradle Files button in the toolbar to make the IDE pick up the changes.

To see a different example of integrating a library project with Android Studio, see using facebook sdk in android studio

Community
  • 1
  • 1
Scott Barta
  • 79,344
  • 24
  • 180
  • 163
  • thank you for the response. I added some settings.gradle file and changed the tree as well. But now it is throwing another error (see my update). Btw, what am I supposed to do with the `pom` file in the `library` folder ? – user1611830 Jan 29 '14 at 22:54
  • You need to set up a build.gradle file for your library; it can't invoke Maven to build it. Maybe it's possible to call out to Maven from Gradle, but you'd be better off trying to set up a Gradle build for it -- it will be a lot less complicated. – Scott Barta Jan 29 '14 at 22:59
  • Thank you again but how can you explain the message I get `A problem occurred configuring root project 'NewsFeeder'. Total time: 6.507 secs > Configuration with name 'default' not found.` Are my new settings in `settings.gradle` and `build.gradle` incorrect ? – user1611830 Jan 29 '14 at 23:20
  • The message isn't very helpful, but is what you see from Gradle when there are major problems with your build.gradle file, in this case, the nonexistence of it. I don't think this message is intentional; it's just how it happens to work. – Scott Barta Jan 30 '14 at 00:50
  • @user1611830 error "'default' not found" comes when any module inside your project lying without its build.gradle file. So check and make them. – Piyush Agarwal Jan 30 '14 at 03:29