Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I build an Android project using Ant? (IntelliJ IDE)

I've a project in the IntelliJ IDEA IDE and I want to set up a parallel, production Ant build process that I can extend over time.

I have used IntelliJ's feature to create an Ant build file, and it is on the Build menu, so the Ant build process is running, and working within the IDE. All good.

But the Ant script IntelliJ has created is only compiling to class files, and is not doing a full Android build process through to an APK (as far as I can tell).

Can you point me towards a reference source (or an example) to help me understand how to get an ANT script doing a full build of an Android project?

If you know, would also be v useful to know how to then extend it to include Proguard, production signing, and inserting the production Maps key :)

like image 354
Ollie C Avatar asked Feb 14 '11 13:02

Ollie C


People also ask

Which is the Ant command to build the project?

To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.


1 Answers

Use this as a starting point:

http://developer.android.com/guide/developing/other-ide.html

I don't know IntelliJ but I shoudn't be very hard to create an ant file with the most frequent commands you need.

UPDATE:

run the following command:

android create project --target 8 --name "MyFirstProject" --path /path/to/project --activity StartingActivity  --package net.sample.package

This will create a project structure. This includes a build.xml file that contains targets to build the project.

To build the application, in the root folder (/path/to/project/) run:

ant debug

It should compile your application.

You may have to install or configure ant before this works correctly but you should be able to figure it out by yourself! :)

(All the info is in the link I posted earlier)

like image 155
Pedro Loureiro Avatar answered Sep 19 '22 18:09

Pedro Loureiro