Sven van den Boogaart
Sven van den Boogaart

Reputation: 12341

Android Referencing a library project

My question might be very simple but I cant find the answer: For my android project I try to implement https://github.com/iPaulPro/aFileChooser In the installation instructions we find:

Add aFileChooser to your project as an Android Library Project.

with a link to http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject When i follow the link point 1 is :

 1. Make sure that both the project library and the application project 
 that depends on it are in your workspace. 
 If one of the projects is missing, import it into your workspace.

How should I do this points ? zip aFileChooser into the main folder, or do i need to right click on app and create new Package or something ?

Note : im using android studio and followed the tutorial in the comments, but android studio dosnt recognize the project as a library. I got the project from github by downloading the zip.

Upvotes: 3

Views: 2338

Answers (2)

Ahmad Zahabi
Ahmad Zahabi

Reputation: 1268

To resolve this problem:

  • Download and unzip the library
  • In your project go to file-> new -> import module -> click on the small button at the right and choose the library that you are downloaded ->ok NOTE: INTO 'aFileChooser-master' THERE ARE 2 FOLDERS: aFileChooser AND aFileChooserExample. YOU SHOULD SELECT aFileChooser
  • Now go to file -> project structure -> select the tab 'app' at the left ->select the tab 'dependencies' -> click on the plus button -> choose module dependencies -> select the library ->ok
  • Finish. Now you can use the classes of the library in your project.

Upvotes: -1

Prokash Sarkar
Prokash Sarkar

Reputation: 11873

1 - In your project's "main" root directory (where the res, java and AndroidManifest.xml file located) create a new folder:

/libs

2- Paste your library in newly created

/libs

folder. Now just download ZIP from Github, rename library directory to "aFileChooser" and copy it.

3 - In app/build.gradle add your library project as an dependency:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile project(":aFileChooser")
}

Upvotes: 3

Related Questions