16

I am used to importing library as .jar file but I don't know how to use the projects from github like this: https://github.com/jfeinstein10/SlidingMenu/

I want to use it in my existing project. I tried including the project file in the dependencies but it's giving me some errors

dgzz
  • 2,929
  • 6
  • 34
  • 56

1 Answers1

24

I already explained in this post how to use a project library in android studio. But I know especially at the beginning it's not that easy until you understand the structur of AS-Projects. So here an explanation for your issue:

I'm adding project libraries to my projects by configuring the gradle files of my project like this:

  • create a folder in your root project directory named 'libs'
  • copy the complete folder 'library' of the SlidingMenu project on git into 'libs'
  • rename the folder 'library' that you just copied to e.g. "SlidingMenuLibrary" (just to avoid confusion)
  • now add this library in your settings.gradle with the following command:

    include ':libs:SlidingMenuLibrary'
    
  • go to your build.gradle file of your AppProject and add the following line to your 'dependencies':

    compile project(':libs:SlidingMenuLibrary')
    
  • at least you have to sync your gradle files: Tools -> Android -> Sync Project with Gradle Files

Please try this. If you get errors please post the log file.

Community
  • 1
  • 1
owe
  • 4,890
  • 7
  • 36
  • 47
  • 27
    I used the method that you explained but I have this error: Gradle 'Surprise' project refresh failed Error:Configuration with name 'default' not found. – Saman Salehi Apr 15 '15 at 13:43
  • Used your method same error as above : project refresh failed Error:Configuration with name 'default' not found. – n j Aug 31 '16 at 07:54