2012-05-30 28 views
0

我在eclipse上使用android SDK。我正在与其他团队成员共享使用git的项目。最初,'Android Dependencies'中的android.jar文件被完全引用(即相对于我的主目录)。为了使它与项目目录相关,我将android.jar复制到项目中的libs /文件夹中,右键单击并添加到构建路径。但是我的项目现在有两个android.jar,一个放在/ libs /文件夹中,另一个放在'Android Dependencies'中。我需要不断删除'Android Dependencies'以阻止由于拥有两个android.jar文件而导致的错误。有什么合适的方法去解决我想要实现的目标?Android eclipse - 在libs文件夹和引用库中复制了android.jar

实质上,我试图实现的是'Android Dependencies'中的android.jar是/ libs /文件夹中的.jar,而不是/ my-home-directory/android中的.jar -sdk Linux的/平台...等。

非常感谢!

+1

eclipse的插件足够智能,可以检测您的android sdk位置,并将它需要的文件拖入eclipse以便为android编译。只要你的团队成员为Android开发设置了Eclipse,它就会自动查找所需的jar文件并根据这些文件进行构建。从libs目录中删除.jar,停止删除自动生成的Dependencies(有一个它继续返回的原因),并将您的构建路径更改回原始状态 – dymmeh

+0

谢谢,这是此场景中最好的建议! – user973758

回答

1

“为什么你想这样做?”。 'android.jar'应该来自已安装的SDK。这个道路对于每个开发者都是不同的,这就是为什么它是绝对的。

如果您使用的是ant,那么每个开发人员应该在项目根文件夹中包含'local.properties'文件。文件片段(该文件不应该是VCS的一部分)。

# This file is automatically generated by Android Tools. 
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! 
# 
# This file must *NOT* be checked into Version Control Systems, 
# as it contains information specific to your local configuration. 

# location of the SDK. This is only used by Ant 
# For customization when using a Version Control System, please read the 
# header note. 
sdk.dir=/install/android-sdks 

如果您使用的是Eclipse,那么每个人都会分别设置其中的偏好设置(Eclipse> Preferences> Android> SDK Location)。

在这两种情况下,如果安装了SDK,每个人都应该能够使用您的项目。无需检查VCS中的android.jar

相关问题