2

To resolve my previous question (How to create a floating action button (FAB) in android, using AppCompat v21? ), i found a nice library here: http://android-arsenal.com/details/1/824 , and i downloaded a .zip file. The web site contains some instructions about the use of the library, but not how to add it to the project with Android Studio (for example: where to copy the downloaded files, and what files i need to copy)

It is the first time that i use a library, and i don't know what i to do. How do I put it to my project?

Community
  • 1
  • 1
devpelux
  • 2,492
  • 3
  • 18
  • 38
  • Here (http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio) – Xcihnegn Mar 08 '15 at 16:02

3 Answers3

12

Well this was a problem I faced few days back. Follow the steps and it will definitely work.

STEP 1:

  • Extract the JAR File from the library and keep it in the Desktop.

STEP 2:

  • In Android Studio, on the left side,There is a Directory View. There is a dropdown menu on top, which has three choices. Project, Packages and Android - choices. Select the 'Project' section.

  • Now under that, you will find two Folders - 'Your Application' and 'External Libraries'.

  • Click on ur Application name and under that, click on the 'app' folder.
  • Now under that there is a folder called 'libs'. This is the folder where you will paste the JAR file you extracted.

Step 3:

  • Paste the JAR file inside the 'libs' folder.

  • After that there is one more important step.

Step 4:

  • Right-click on the file that you pasted on the 'libs' folder and select the option 'Add As Library'.
  • Then a popup will appear asking to create the library.
  • Under 'Add to Module', select 'App'.
  • Then press ok.

Wait for a while for the Gradle to build it. After that , Enjoy. Your new Library is available in your 'imports'.

Swarna nEel
  • 142
  • 8
0

It's is very simple: Follow the instruction below

  1. copy the line below and navigate to build.gradle file on your project & the open it. compile 'com.melnykov:floatingactionbutton:1.2.0'
  2. Paste the copied text here:

dependencies { ............................ compile 'com.melnykov:floatingactionbutton:1.2.0' ............................ }

  1. Click the sync gradle file icon on the toolbar. enter image description here
  2. Enjoy !
Shanmugapriyan
  • 953
  • 1
  • 10
  • 28
0

If I remember correctly you just drag and drop the library to the AS project. you have to unzip first to have a .jar file. If you want to use Maven you have to add the dependencies to the gradle.

Einar Sundgren
  • 4,325
  • 9
  • 40
  • 59