Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

James Shockley
James Shockley
35 Points

Switching Android Studio from Eclipse. How the heck do I import my libraries? 1.2.11

Have a bunch of 3rd party libraries. I've googled, but most questions/ results are from older versions. I've broken my project half a dozen times trying to figure this out. Cardviews, recyclers, and support are fine, but none of my 3rd parties are.

Thank you for any assistance.

2 Answers

Jon Kussmann
PLUS
Jon Kussmann
Courses Plus Student 7,254 Points

Most libraries that you'll find on Github will have a line that tells you how to add the library to your project. For example: Picasso

You'll see the line:

compile 'com.squareup.picasso:picasso:2.5.2'

Add that to your build.gradle file (App module) under dependencies. Android Studio will ask you to sync and then you should be able to use the library.

Seth Kroger
Seth Kroger
56,413 Points

If you have the .jar files on your machine locally there is a directory called 'libs' in the app module (Make sure the upper left of the project is set to "Project" and not "Android" to see the actual files) There should also be line in the build.gradle file that says:

compile fileTree(include: ['*.jar'], dir: 'libs')

It will automatically include all the jar files in the libs directory and add them to the project. If it's not there, just add it under dependencies. Just copy the jars into that folder, sync gradle, and it should work.