2012-12-12 27 views
1

我試圖弄清楚如何將庫jar鏈接到我的android項目。Build.xml jar.libs.dir

我創建的build.xml文件與

android update project -p . 

而且我已經定義ant.properties作爲

jar.libs.dir=lib 

我還添加了 - 預構建的任務複製一些庫到目錄:

<target name="-pre-build"> 
    <copy todir="${jar.libs.dir}"> 
    <fileset 
     dir="absolute-path-from-my-dir" 
     includes="*.jar" /> 
    </copy> 
</target> 

這個成功了,因爲我可以看到t他在螞蟻輸出:

-pre-build: 
    [copy] Copying 2 files to absolute-path-to-my-lib 

不過,我也可以看到這一點:

-build-setup: 
    [echo] Resolving Build Target for MyAndroidApp... 
[gettarget] Project Target: Android 2.3.3 
[gettarget] API level:  10 
    [echo] ---------- 
    [echo] Creating output directories if needed... 
    [echo] ---------- 
    [echo] Resolving Dependencies for MyAndroidApp... 
[dependency] Library dependencies: 
[dependency] No Libraries 
[dependency] 
[dependency] ------------------ 
[dependency] API<=15: Adding annotations.jar to the classpath. 

和javac任務失敗,因爲它不能找到那些在圖書館類。

我錯過了什麼?

+0

看看這個以前問一個問題: HTTP:/ /stackoverflow.com/questions/7723135/adding-referenced-jars-to-android-build-xml –

+0

我已經做到了。我在ant.properties中相應地定義了jar.libs.dir –

回答