Generate Android App APK Using Apache ANT

The apk of Android apps which are created when we directly run an application from Eclipse comes signed with debug certificate (unsigned apk).

We can sign the Android app APK either using application signing wizard or using ANT commands. In this tutorial we will see about generating apk using ANT.

Generate apk using ANT

If you don’t have Ant, you can obtain it from the Apache Ant home page ( http://ant.apache.org/ )

Install it and make sure it is in your executable PATH.

Before calling Ant, you need to declare the JAVA_HOME environment variable to specify the path to where the JDK is installed.

Note: When installing JDK on Windows, the default location is in the “Program Files” directory. This location will cause ant to fail, because of the space. To fix the problem, you can specify the JAVA_HOME variable like this.

1

set JAVA_HOME=c:\Progra~1\Java\&lt;jdkdir&gt;

The Eclipse project generation wizard does not create the require Apache Ant build.xml file. You can generate it in the command line.

If you want to generate signed apk for your application then you have to create the ant.properties file in your project directory. In this file you have to set up your keystore details/path.

After doing these procedure, you can now create a release build.

After we run the release command, all .apk are generated in project’s bin folder.

Note : The signed apk will have name with “-release.apk” postfix and Unsigned apk has “-release-unsigned.apk” postfix.

Android Team @ WeblineIndia

We have developed lots of Android apps for various domains like – Business, Social, Medical, News, Sports, Education, etc. We also have expertise in custom SDK development.

Following well defined standard development processes, coding standards, tools and techniques, it has always helped us to provide best mobile apps to our clients. Our main focus has always been to exceed client expectations and deliver easy to use technically strong apps. On the side, we also love contributing back to the community.