android项目关联android library project失败问题

来源:互联网 发布:win8连接网络打印机 编辑:程序博客网 时间:2024/05/19 17:04

近日,在做一个人人的第三方小项目。打算直接使用renren 的sdk 进行开发。因为renren的sdk是以android library project 形式发布的(关于这种project的内容可以参考android library project)。

整个导入流程严格按照guide的内容操作,但是始终无法导入,设置导入后项目中不出现相关的Library project。在设置完library之后重新打开始始终显示关联错误,就是reference那里是个红叉。Eclipse也没有任何出错提示。在stackoverflow上也找过相应问题,找到了解决问题的方案(StackOverFlow上的解答)。虽然有效的解决了问题,但是解释并不是很完善。

秉承着博主格物致知严谨认真实事求是风骚火辣的钻研精神,经过一番实验,我发现其实只要项目中project.properties的引用android.library.reference.1=这里的值为相对路径,则没有引用问题,因为相同的project博主用git同步到ubuntu下关联就没有问题。所以很大的可能这是ADT的一个bug,即:

在windows系统下,library project必须和project处于相同的盘符中,因为如果在不同盘符,project.properties中的android.library.reference.1值变成绝对路径,而ADT推荐是在ubuntu下使用的,对windows绝对路径有支持bug。在windows系统下,library project必须和project处于相同的盘符中,因为如果在不同盘符,project.properties中的android.library.reference.1值变成绝对路径,而ADT推荐是在ubuntu下使用的,对windows绝对路径有支持bug。

——————华丽的分割线——————————-

Environment: windows xp sp3,eclipse 1.7 Indigo Release, ADT 16.0.1.v201112150204-238534(in fact I used ADT15 before, since I got this problem I updated the ADT but still didn’t work).

Description: On windows system, I had an android library project A, which store in disk D:, I also had a project B which store in disk E:, I want to use project A as the library project in project B, but no matter what I did, the reference was error. Properties->android-> library showed a big red cross. (followed the guide). A guy at Stack over flow has the same problem and gave the solution), but didn’t say why, so I made a little test and I thought I figure this out.

Guess: In project B, the ‘project.properties’ file use this line: ‘android.library.reference.1=’ to point library project. Here is what happen, In Linux system, there is no path problem, the path string of ‘android.library.reference.1’ in ‘project.properties’ file will always be relative path. But in windows system, if the android library project and android project is in different disk, the path string will be absolute path. I think there are some problems in ADT to solve the absolute path on windows system.

原创粉丝点击