Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In eclipse, unable to reference an android library project in another android project

As I was writing up this question I managed to solve it so repeat it here for the benefit of others. Here is the initial problem:

I have created a very simple library project which I want to reference in another project. I have done this previously with no problems so not really sure why it is not working this time. I have:

  1. Flagged the library project via project properties. The default.properties file has this set : android.library=true

  2. In my other project added reference to my library project via project properties. The default.properties file has the reference added as expected ie android.library.reference.1=K:/android_test_ws/applicationRegistrar

  3. The green tick against the referenced library project starts off green and then changes to a red cross.

This implies that there must be something wrong / missing from the library project but I don't know what. My library project on this occasion is MUCH simpler than the previous one I created.

like image 879
malcooke Avatar asked Mar 02 '11 12:03

malcooke


2 Answers

OK Here is the solution which I found when I was looking for the default.properies file of the referencing project (not the library) in my file system. Although the referencing project was in the same eclipse workspace as the library project, the actual files were somewhere else in the file system ie they were'nt in the same parent folder of the library project. As soon as I placed the referencing project in the same physical folder as the library project it all went fine.

I guess that this must be something to do with android using ant underneath the covers.

Edit: The project name needs match the folder name on the file system. What you are seeing in the Project Properties->Android->Library Reference is a relative file system path.

like image 105
malcooke Avatar answered Oct 12 '22 00:10

malcooke


Make Sure both the projects are present in same work space. To Do it, while importing the projects make sure "copy project into work space" check box is checked.

like image 42
Karthik Dheeraj Avatar answered Oct 12 '22 01:10

Karthik Dheeraj