Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android include .jar in ant compilation

I try to include in my application compilation a .jar compiled.

I use ant to compile my Android application.

When I add this task to build.xml :

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

compilation failed on android package importation :

[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]                   ^

Whereas when my task was not in build.xml, compilation succeeded.

like image 494
TheFrancisOne Avatar asked Feb 24 '11 17:02

TheFrancisOne


1 Answers

If you're using the standard ant script from android create project then you should be able to dump any jars in a libs directory and have them included automatically (documentation).

like image 175
Dominic Mitchell Avatar answered Oct 13 '22 10:10

Dominic Mitchell