Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
188 views
in Technique[技术] by (71.8m points)

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.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...