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

tony lin
538 Pointshow to import 3rd party library to existing android project?
I am using Android Studio, want to import this as library https://github.com/keyboardsurfer/Crouton I tried to import it as module, got maven syncing error. Not sure how to fix this. Can someone tell me in detail steps, exactly how to import library properly in Android studio?

David Hope
19,876 PointsHi Tony, in order to use a 3rd-party library in Android Studio you need to copy the "compile" code from the dependencies section of the particular library on GitHub, paste it into your build.gradle file(The first of the two) in Android Studio under its dependencies section, then Sync the changes, which you'll be prompted by Gradle to do. Here's an example: dependencies compile('de.keyboardsurfer.android.widget:crouton:1.8.4')
The documentation on GitHub for the library you're using will guide you on how to use it in your projects.
In case you're interested, Mr. Jakuben wrote a very helpful Blog post on third-party libraries this summer which is worth reading if you haven't already http://blog.teamtreehouse.com/android-libraries-use-every-project
Good luck with your project! -David

tony lin
538 PointsWow, I don't know it is that simple...... I have wasted a lot of time to search on google, but never able to find answer. Thank you David, total life saver!
1 Answer

David Hope
19,876 PointsYou're very much welcome Tony!
tony lin
538 Pointstony lin
538 PointsPlease help, no one ever imports 3rd party library?