我试图找出如何将库jar链接到我的android项目。
我用
创建了build.xmlandroid update project -p .
我已将 ant.properties 定义为
jar.libs.dir=lib
我还添加了一个-pre-build任务来将一些lib复制到目录:
<target name="-pre-build">
<copy todir="${jar.libs.dir}">
<fileset
dir="absolute-path-from-my-dir"
includes="*.jar" />
</copy>
</target>
并且这成功了,因为我可以在ant输出中看到这个:
-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任务失败,因为它找不到库中的类。
我错过了什么?