Android includes .jar in ant compilation

I am trying to include .jar compiled in my compilation.

I use ant to compile my android application.

When I add this task to build.xml:

 <javac srcdir="${src}"
     classpath="xyz.jar" />

failed to compile when entering android package:

[javac] Compiling 1 source file
[javac] C:\HelloWorld\src\com\example\hellowolrd\HelloWorld.java:3: package android.app does not exist
[javac] import android.app.Activity;
[javac]                   ^

If my task was not in build.xml, the compilation was successful.

+5
source share
4 answers

If you use the standard ant script from android create project, then you can reset all banks in the directory libsand turn them on automatically ( documentation ).

+11
source

I just added lib to javac and it did the trick:

ant -lib lib debug
+3

build.xml, ( , ..) , :

<javac srcdir="libs"
     classpath="xyz.jar" />

build.xml, .

ant -lib lib debug
+1

All Articles