ant scripts to build apk file and load it in a emulator?

by » Mon, 19 Jul 2010 16:52:20 GMT

Sponsored Links

i am trying to create a build.xml script that cleans, builds and
creates a apk file of a Junit android test project that i have

the steps i want to achieve in my build file is this:

[list=]create apk file[/list]
[list=]Sign apk file[/list]
[list=]launch emulator[/list]
[list=]install apk file[/list]
[list=]run instrumentalTest[/list]
[list=]Save the tests into an HTML Junit Report[/list]

Anyone know how to achieve this? so far my build file looks like this:

[code]<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply

create one in the same
directory with the processing instruction <?

as the first entry and export the buildfile again.

<project basedir="." default="build" name="Unity Agent SDK Test">
<property environment="env" />
<property name="junit.output.dir" value="junit" />
<property name="debuglevel" value="source,lines,vars" />
<property name="target" value="1.6" />
<property name="source" value="1.6" />
<property file="" />
<path id="android1.6.userclasspath">
<pathelement location="lib/android.jar" />
<path id="Junit.userclasspath">
<pathelement location="lib/junit-4.8.2" />
<pathelement location="lib/
org.hamcrest.core_1.1.0.v20090501071000.jar" />
<path id="Unity Agent SDK Test.classpath">
<pathelement location="bin" />
<pathelement location="lib/fb_connect-android-api.jar" />
<pathelement location="lib/signpost-commonshttp4-1.2.jar" />
<pathelement location="lib/signpost-core-1.2.jar" />
<pathelement location="lib/UnityAgentSDK.jar" />
<path refid="android1.6.userclasspath" />
<path refid="Junit.userclasspath" />

<path id="android.antlibs">
<pathelement path="${android-sdk-path}/tools/lib/anttasks.jar"
<pathelement path="${android-sdk-path}/tools/lib/sdklib.jar" />
path="${android-sdk-path}/tools/lib/androidprefs.jar" /
path="${android-sdk-path}/tools/lib/apkbuilder.jar" />
<pathelement path="${android-sdk-path}/tools/lib/jarutils.jar"

<path id="run.Unity Agent SDK Test (1).classpath">
<path refid="Unity Agent SDK Test.classpath" />
<path id="run.Unity Agent SDK Test (1).bootclasspath" />
<target name="init

Other Threads

1. cara ganti ringtone u/ SMS di Magic

Rekans, ada bbrp pertanyaan nih :
1.gimana ya caranya ganti ringtone yg buat sms di HTC Magic??udah coba move
atopun copy dari SD ke folder yg di media |      notification, ttp aja ga
2. kenapa browser bawaan ga bisa dipake?pdhl connect i-net sudah bisa
3. kenapa alarm ga bisa kluar suaranya??
 Maklum nih...baru 2 malem pake Magic,hehee...


Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to

To request to subscribe to this group, please visit the following page:

2. How to add a view to application layout programmatically


I want to add an ImageView to my layout when a button has been
pressed. Sadly, I cannot get a handle to the main application's
linearlayout, I always get a null pointer error when trying to
retrieve the layout using findViewByID.

Here's the code that ought to display the image when button b has been
pressed, but I think I have missed something obious:


import android.os.Bundle;
import android.view.*;
import android.view.ViewGroup.LayoutParams;
import android.widget.*;
import android.content.*;
import android.util.Log;

public class AndroidTest extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

     // assign flag.png to the button, loading correct flag image for
current locale
        Button b;
        b = (Button)findViewById
( ;//.setBackgroundDrawable(this.getResources

        // build dialog box to display when user clicks the flag
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
            .setPositiveButton("Done", new
DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
        final AlertDialog alert = builder.create();

        // set click listener on the flag to show the dialog box
        b.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                ImageView image;
                image = new ImageView(v.getContext());

                LinearLayout main = (LinearLayout)
                // some debug code
                if (main == null)
                        Log.v("abc", "Main is null");
                main.addView(image, 200, 200);



3. Any way to update the Framework changes in build without rebuilding all ?

4. using servlet in mobile with Android platform

5. resource with name from numbers

6. Android Software Engineer - 15.000 PLN / m-c

7. profiles manager