Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing github projects as library to existing project [duplicate]

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

like image 233
dgzz Avatar asked Dec 09 '13 09:12

dgzz


People also ask

Can we copy projects from GitHub?

On the top-right side of the classic project, click Menu. Click , then click Copy. Under "Owner", use the drop-down menu and click the repository or organization where you want to copy the project board. Optionally, under "Project board name", type the name of the copied classic project.

How do I clone a Git repository to another repository?

Navigate to the repository you just cloned. Pull in the repository's Git Large File Storage objects. Mirror-push to the new repository. Push the repository's Git Large File Storage objects to your mirror.


1 Answers

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.

like image 99
owe Avatar answered Sep 17 '22 15:09

owe