Home Tutorials Hints & Tips

Adding External Libraries in Android Studio

Android Studio makes a good job of importing projects from Eclipse. However, it has a tendency to fail to include some external libraries that are part of the Eclipse project. I will show you here the problem I have and how to remedy the situation.

The screen shot below shows a typical error that occurs when I import a project. Here the missing Amazon mobile ads library is the cause of the problem.

Android Studio screenshot Java library error

If you take a look at the file structure associated with this project, you can see that under the app folder there are only two sub-folders, “build” and “src”. Creating a project from scratch would include a third called “lib”.

Folder

What we need to do is manually create the lib folder and copy the missing jar file to this lib folder. This would modify the structure to that seen below.

Folder

You now need to restart Android Studio. Once restarted, you will see the project navigation tree now includes the lib folder and library jar file.

Android Studio lib folder

The final step is to right click on the library file name and select “Add As Library”.

Android Studio add as library

After you do that the errors should disappear.

Android Studio error gone

Privacy and Cookies Disclaimer Copyright
© 2015 - 2018 North Border Tech Training All rights reserved