How to remove a dependency from my Android project

2019-06-15 00:45发布

问题:

When I highlight my project, go to properties, select java build path and then try to remove an Android Dependency from my list of Android dependencies the remove button is grey'd out. How can I remove that specific dependency?

回答1:

Delete the dependency from the libs folder.



回答2:

JFTR:

I have had similar problem after a messed merge of two projects branches on Eclipse. I could revert the merge as I did not commited yet, but Eclipse project files that I do not store in my repository was messed.

The solution for me was to:

  1. Delete the error message from "Problems" view.
  2. Clean the project (Project / Clean...)

Solved!



回答3:

Well, the above solutions didn't work for me so I just enter the project.properties file and remove the dependency (which is written there as a reference).
These are the steps on Ubuntu:

  1. Using console on project root folder type sudo vi project.properties
  2. Go to the line that you want to remove and delete it (you can type double d to remove a line --> dd)
  3. Close and save the file (press ESC and then wq)
  4. Clean the project and rebuild.

Note: Before you change project.properties manually you are strongly advised to backup your project since this operation is unsafe!!!

Sorry for the elaboration for those who speak fluent Linux.



回答4:

2 types of dependencies I can found so far under Android Dependencies:

  1. Build path to your workspace libs folder
  2. Build path to some other project which install by Android tools and create as another project under Eclipse, e.g. GridLayout for android(android-support-v7-gridlayout.jar)

To remove the first one, it is easy. Just delete the jars under libs folder. To remove the second one, it is also easy. Just go to the project's Build Path, select Android, remove the reference item under Library panel