0

I am trying to add commons-io-2.4.jar to my android studios project but there are no clear instructions on how to do it. Can someone show steps, in detail, on how to add the jar file to a project in Android Studios?

  • 1
    Possible duplicate of [Android Studio: Add jar as library?](http://stackoverflow.com/questions/16608135/android-studio-add-jar-as-library) – Lukas Knuth Mar 10 '16 at 16:11
  • no, that is for another jar file. I want answers on the jar I'm trying to add, specifically. I've looked at others but none have gone into detail about how to properly add it. – Nikita Davis Mar 10 '16 at 16:16
  • 2
    The process is exactly the same, no matter which Jar it is. You could just try it. – JonasCz Mar 10 '16 at 16:24
  • I did. that process says to put the jar file into the libs folder. Where is the libs folder? Does that mean in Android Studios? Does it mean do it from the file explorer in Windows? If that means in Android Studios, how do I get to it? I don't see it – Nikita Davis Mar 10 '16 at 16:27

2 Answers2

1
  1. Create a folder called 'libs' under your apps directory in Android studio for your project.
  2. Add the jar file.
  3. in your build.gradle file:

    dependencies {
      compile files ('libs/commons-io-2.4.jar')
    
    }
    

EDIT: here is what your directory structure should look like:

directory sturcture

Kristy Welsh
  • 6,477
  • 9
  • 53
  • 87
  • is that a java class? module? Android resource file? I don't see just "folder". – Nikita Davis Mar 10 '16 at 16:30
  • Ah...ok. That's where the disconnect was. I was under "Android" where I'm guessing everybody else was under "Project" (where the drop down menu is). Thank you for the screenshot. I'm getting a completely different error now saying "Supplied String module notation 'libs/commons-io-2.4.jar' is invalid". But that's better than seeing that other issue for 3 days straight. – Nikita Davis Mar 10 '16 at 17:01
  • @NikitaDavis See edited answer, I forgot 'files' after compile. – Kristy Welsh Mar 10 '16 at 17:04
  • thank you for your patience...that seem to have worked – Nikita Davis Mar 10 '16 at 18:10
0

go to File -> Project Structure -> Modules -> app -> Dependencies click on green plus button and select File dependencies and chose your .jar file

Reza Nazeri
  • 320
  • 3
  • 11