Cannot Add Library to Android Project in Eclipse

微笑、不失礼 提交于 2019-11-29 09:40:21
Umar Ahmad

Make sure that the libraries and the project are at the same place, i.e.

  1. Copy the libraries in the same folder as your project
  2. Import the libraries (file > Import > Existing Project in workspace)
  3. Open properties of library > Android and select Is Library
  4. Open project properties > Android > Add (library)
  5. Select the library
  6. save the properties

If this does not work for you copy the jar files from its lib folder and paste it in the projects lib. This should only be done if the above method doesn't work

Import Library project in eclipse . Then right click on project and go to properties->Android (Menu on left side) --> At the bottom(below project build target) you will see a check box named is Library Check that box. Now you've made your project a library .

Then in your orignal project where you want to add library go again to to properties->Android (Menu on left side) --> At the bottom(below project build target) Click add button and you will find that library project visible.

This happens when you import the project from some location. If we import some project then it doesn't refer to the supporting library of that workspace. So always check the check box( copy projects to workspace) Go to file>import project>browse>select a project>Check the copy project into workspace. Hope it solve the issue.

A late answer, although I thought of giving an in-depth answer to this question.

  1. First switch your folder structure from Android to Project.

  1. Now search for the libs folder inside app - build folder.

  1. Once you have pasted the .jar file inside libs folder. Right click on the jar file and at end click on Add as library. This will take care of adding compile files('libs/library_name.jar') in build.gradle

Now you can start using the library in your project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!