19
Generally, copy following target to your build.xml or custom_rules.xml. Note that in custom_rules.xml (if it doesn't yet exist) you need to wrap this in a element.
<target name="start">
<xpath input="AndroidManifest.xml"
expression="/manifest/@package"
output="manifest.package" />
<xpath input="AndroidManifest.xml"
expression="/manifest/application/activity[intent-filter/action/@android:name='android.intent.action.MAIN']/@android:name"
output="manifest.main" />
<echo level="info">Restart main activity ${manifest.package}/.${manifest.main}</echo>
<exec executable="${android.platform.tools.dir}/adb">
<arg value="shell"/>
<arg value="am"/>
<arg value="start"/>
<arg value="-S"/>
<arg value="-a"/>
<arg value="android.intent.action.MAIN"/>
<arg value="-n"/>
<arg value="${manifest.package}/.${manifest.main}"/>
</exec>
</target>
executing adb shell am start -a android.intent.action.MAIN -n <Package_name>/.<Activity> from ant should launch your app.ofcourse you need to build and install the app trying to start the app...you can use android build xml to build and use "adb install " to install the app...