2012-05-30 31 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

相關問題