<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Novoda &#187; Tools</title>
	<atom:link href="http://novoda.com/category/blog/android/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://novoda.com</link>
	<description>Android mobile development and consultancy</description>
	<lastBuildDate>Wed, 05 Oct 2011 11:15:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Android continuous integration &#8211; Android Maven plugin</title>
		<link>http://novoda.com/2010/08/13/android-continuous-integration-android-maven-plugin/</link>
		<comments>http://novoda.com/2010/08/13/android-continuous-integration-android-maven-plugin/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 11:02:07 +0000</pubDate>
		<dc:creator>Kamil Olesiejuk</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[maven]]></category>

		<guid isPermaLink="false">http://novoda.com/?p=414</guid>
		<description><![CDATA[Continuous feedback on how our changes affect the current code allow us to confidently add  functionality. Documentation around testing on the Android platform continuous or otherwise is scarce so here we explain how to continuously compile your Android project’s tests in a central area for the benefit of the whole team and it’s clients.
The [...]]]></description>
			<content:encoded><![CDATA[<p>Continuous feedback on how our changes affect the current code allow us to confidently add  functionality. Documentation around testing on the Android platform continuous or otherwise is scarce so here we explain how to continuously compile your Android project’s tests in a central area for the benefit of the whole team and it’s clients.</p>
<p>The main components of our continuous integration system are:</p>
<div>
<ul>
<li><a href="http://maven.apache.org/">Maven</a></li>
<li><a href="http://hudson-ci.org/">Hudson</a></li>
<li><a href="http://developer.android.com/sdk/index.html">Android SDK</a></li>
<li><a href="http://code.google.com/p/maven-android-plugin/">Android Maven plugin</a></li>
<li><a href="http://wiki.hudson-ci.org/display/HUDSON/Android+Emulator+Plugin">Android Hudson plugin</a></li>
<li><a href="http://www.github.com/novoda">Github</a></li>
</ul>
</div>
<p>Here we wish to share and  document our set up and explore some capabilities of the android maven plugin. If you are brand new to it you may wish to first check out <a href="http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html">Maven in 5 minutes</a> and maven-android-plugin’s useful <a href="http://code.google.com/p/maven-android-plugin/wiki/GettingStarted">Getting Started </a> guide.</p>
<p>Android maven plugin helps us with the following android deployment tasks:</p>
<div>
<ul>
<li>Building your App</li>
<li>Running Behaviour / Unit Tests</li>
<li>Running Instrumentations</li>
<li>Setting up your test environment</li>
<li>Signing your release</li>
<li>Optimization of .apk files via zipalign</li>
</ul>
</div>
<p>We want to show you a real example of an application built with the help of the maven-android-plugin. It&#8217;s an Avatar Creator app for <a href="http://www.weeworld.com/">WeeWorld</a>.</p>
<p><a href="http://www.weeworld.com/"><img src="http://novoda.com/wp-content/uploads/2010/08/splash_screen.png" alt="WeeMee"/></a><a href="http://novoda.com/wp-content/uploads/2010/08/weeworldQR.png"><img width="200" height="200" src="http://novoda.com/wp-content/uploads/2010/08/weeworldQR.png" alt="WeeWorld"/></a></p>
<p>The app is now on the market, so go ahead and check it out! (0.99$)</p>
<p>If you&#8217;re quite familiar with maven and the android plugin, you might want to jump straight to the Real Life Example at the end of this post and check out the full configuration.</p>
<h3 name="build">
<p>Building your App</p>
</h3>
<p>To buid an apk, your app first needs to cite a version of android platform as a build path dependency in your application&#8217;s pom file (as provided scope). More on <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html">dependency scope</a>.</p>
<pre class="sh_xml">
&lt;dependency&gt;
&nbsp;&nbsp;&lt;groupId&gt;com.google.android&lt;/groupId&gt;
&nbsp;&nbsp;&lt;artifactId&gt;android&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;version&gt;2.2.1&lt;/version&gt;
&nbsp;&nbsp;&lt;scope&gt;provided&lt;/scope&gt;
&nbsp;&nbsp;&lt;type&gt;jar&lt;/type&gt; &lt;!-- optional --&gt;
&lt;/dependency&gt;
&lt;!--Currently valid values: 1.5_r3,1.6_r2,2.0_r1,2.0.1_r1,2.1_r1,2.2.1--&gt;
&lt;!--Those packages are on the maven central repository--&gt;
</pre>
<p></br></p>
<p>The project must then reference the maven android plugin within the project’s pom along with the android API level targeted, here we cite version 2.2 (api level 8 )</p>
<pre class="sh_xml">
&lt;plugin&gt;
&nbsp;&nbsp;&lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
&nbsp;&nbsp;&lt;artifactId&gt;maven-android-plugin&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;configuration&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;sdk&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;platform&gt;8&lt;/platform&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/sdk&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;deleteConflictingFiles&gt;true&lt;/deleteConflictingFiles&gt;
&nbsp;&nbsp;&lt;/configuration&gt;
&nbsp;&nbsp;&lt;extensions&gt;true&lt;/extensions&gt;
&lt;/plugin&gt;
</pre>
<p></br></p>
<p>Reference a java compiler version, since the default source and target values are 1.3 and 1.1 respectively, and android uses annotations conforming to java 5</p>
<pre class="sh_xml">
&lt;plugin&gt;
&nbsp;&nbsp;&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;configuration&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;source&gt;1.5&lt;/source&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;target&gt;1.5&lt;/target&gt;
&nbsp;&nbsp;&lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
<p></br></p>
<p>If your project uses Any android platform plugins for instance Google maps, additional dependencies will also require referencing in the project’s pom:</p>
<pre class="sh_xml">
&lt;dependency&gt;
&nbsp;&nbsp;&lt;groupId&gt;com.google.android.maps&lt;/groupId&gt;
&nbsp;&nbsp;&lt;artifactId&gt;maps&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;version&gt;8_r1&lt;/version&gt;
&nbsp;&nbsp;&lt;type&gt;jar&lt;/type&gt;
&lt;/dependency&gt;
&lt;!-- Current versions:  3, 4_r2, 7_r1, 8_r1 --&gt;
&lt;!-- NOTE: those are the ones defined by goole and are  NOT in the maven
central repository and need to be installed manually with:
mvn install:install-file wih proper parepeters as decribed here:

http://maven.apache.org/plugins/maven-install-plugin/usage.html

e.g. mvn install:install-file
-Dfile=$ANDROID_HOME/add-ons/addon_google_apis_google_inc_8/libs/maps.jar
-DgroupId=com.google.android.maps -DartifactId=maps -Dversion=8_r1
-Dpackaging=jar --&gt;
</pre>
<p></br></p>
<p>Additionally one should remember to specify the source directory if the folder structure does not follow the default maven structure:</p>
<pre class="sh_xml">
&lt;sourceDirectory&gt;${project.basedir}/src&lt;/sourceDirectory&gt;
</pre>
<p></br></p>
<p>At the same time remember NOT to specify the resource directory, as maven-android-plugin handles Android-specific resources on its own, and we don&#8217;t wnt duplicates.</p>
<p>This will already get your project building, but there’s much more that maven can do for You. Let’s look at some of that now.</p>
<h3 name="instrument1">
<p>Testing your App with an Instrumentation</p>
</h3>
<p>You most hopefully have an accompanying instrumentation test instrumentation project for your Android application and maven can build and run these against your previously compiled project. Maven can build the test project, deploy both the app and the test, and run the instrumentation on an attached device or an emulator.</p>
<p>Within the instrumentation test project it will need the following dependency:</p>
<pre class="sh_xml">
&lt;dependency&gt;
&nbsp;&nbsp; &lt;groupId&gt;com.google.android&lt;/groupId&gt;
&nbsp;&nbsp;&lt;artifactId&gt;android-test&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;version&gt;2.2.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;!-- Allowed values same as for android package --&gt;
 </pre>
<p> </br></p>
<p>If it depends upon the source code of the application which it tests:</p>
<pre class="sh_xml">
&lt;dependency&gt;
&nbsp;&nbsp;&lt;!-- optional: compile time dependency, in this case so that we can --&gt;
&nbsp;&nbsp;&lt;!-- read from the R.java for example. --&gt;
&nbsp;&nbsp;&lt;groupId&gt;my.app.group&lt;/groupId&gt;
&nbsp;&nbsp;&lt;artifactId&gt;myapp&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;version&gt;${project.version}&lt;/version&gt;
&nbsp;&nbsp;&lt;scope&gt;compile&lt;/scope&gt;
&nbsp;&nbsp;&lt;type&gt;jar&lt;/type&gt;
&lt;/dependency&gt;
</pre>
<p></br></p>
<p>Instrumentations are run through a series of interactions within a pseudo environment so you will need to specify the Device/AVD(Android virtual Device) upon which you wish to run tests:</p>
<pre class="sh_xml">&lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
&lt;artifactId&gt;maven-android-plugin&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;configuration&gt;
&nbsp;&nbsp;&lt;emulator&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;avd&gt;22&lt;/avd&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- name of the avd to deploy to and run the instrumentation on --&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;wait&gt;150000&lt;/wait&gt; &lt;!-- wait time for the emulator to start --&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;options&gt;-partition-size 128 -wipe-data&lt;/options&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- additional options to run the emulator with--&gt;
&nbsp;&nbsp;&lt;/emulator&gt;
&nbsp;&nbsp;&lt;undeployBeforeDeploy&gt;true&lt;/undeployBeforeDeploy&gt;
&lt;/configuration&gt;
</pre>
<p></br></p>
<p>Devices to deploy to can be specified by a serial number but generic “usb” and “emulator” values are also valid. More detailed documentation can be found <a href="http://maven-android-plugin-m2site.googlecode.com/svn/emulator-start-mojo.html">here</a>.</p>
<h3>
<p>Instrumentation environment</p>
</h3>
<p>Instrumentations can interact at various hook in points during the a devices connected lifecycle. Execution and binding it to a maven lifecycle phase is specified like:</p>
<pre class="sh_xml">
&lt;executions&gt;
&nbsp;&nbsp;&lt;!-- android plugin execution that starts the emulator. --&gt;
&nbsp;&nbsp;&lt;execution&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;id&gt;startemulator&lt;/id&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- bound to the 'initialize' phase --&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;phase&gt;initialize&lt;/phase&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;goals&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goal&gt;emulator-start&lt;/goal&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/goals&gt;
&nbsp;&nbsp;&lt;/execution&gt;
&lt;/executions&gt;
</pre>
<p></br></p>
<p>The configuration above binds the android plugin’s ‘emulator-start’ goal to the ‘initialize’ phase of the maven lifecycle. This is the equivalent of  manually executing mvn android:emulator-start, from a directory with a pom containing valid configuration for it. Stopping the emulator does not require this and can be run anywhere and anytime with mvn android:emulator-stop.</p>
<p>If we would like to stop the emulator after running the instrumentation tests, we would add the following execution:</p>
<pre class="sh_xml">
&lt;execution&gt;
&nbsp;&nbsp;&lt;!-- android plugin execution that starts the emulator. --&gt;
&nbsp;&nbsp;&lt;id&gt;stopemulator&lt;/id&gt;
&nbsp;&nbsp;&lt;!-- bound to the 'install' phase --&gt;
&nbsp;&nbsp;&lt;phase&gt;install&lt;/phase&gt;
&nbsp;&nbsp;&lt;goals&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;goal&gt;emulator-stop&lt;/goal&gt;
&nbsp;&nbsp;&lt;/goals&gt;
&lt;execution&gt;
</pre>
<p></br></br></p>
<h3>
<p>Signing your release</p>
</h3>
<p>By default, the plugin will sign the apk with the debug key. This can be disabled, producing an unsigned apk.</p>
<pre class="sh_xml">
&lt;configuration&gt;
&nbsp;&nbsp;&lt;sign&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;debug&gt;false&lt;/debug&gt;
&nbsp;&nbsp;&lt;/sign&gt;
&lt;configuration&gt;
</pre>
<p></br></p>
<p>To sign and apk with your key, we will need to use the maven-jarsigner-plugin. Although it’s a different plugin, since it’s very relevant here’s how we did it:</p>
<pre class="sh_xml">
&lt;plugin&gt;
&nbsp;&nbsp;&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&nbsp;&nbsp;&lt;artifactId&gt;maven-jarsigner-plugin&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;version&gt;1.2&lt;/version&gt;
&nbsp;&nbsp;&lt;executions&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;execution&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id&gt;signing&lt;/id&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goals&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goal&gt;sign&lt;/goal&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/goals&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;phase&gt;package&lt;/phase&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;inherited&gt;true&lt;/inherited&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;configuration&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;includes&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;include&gt;
${project.build.directory}/target/${project.artifactId}-${project.version}.apk
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/include&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/includes&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;keystore&gt;${keystore.location}&lt;/keystore&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;storepass&gt;${keystore.password}&lt;/storepass&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;keypass&gt;${keystore.keypass}&lt;/keypass&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;alias&gt;${keystore.alias}&lt;/alias&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;verbose&gt;true&lt;/verbose&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/configuration&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/execution&gt;
&nbsp;&nbsp;&lt;/executions&gt;
&lt;/plugin&gt;
</pre>
<p></br></p>
<p>Configures the jarsigner plugin with the files (input, output), and the keystore details. Binds the plugin’s ‘sign’ goal to the ‘package’ phase of the maven lifecycle.</p>
<p>The ${kestore.*} variables above come from the settings.xml file, and look:</p>
<pre class="sh_xml">
&lt;properties&gt;
&nbsp;&nbsp;&lt;keystore.location&gt;path/to/test.keystore&lt;/keystore.location&gt;
&nbsp;&nbsp;&lt;keystore.password&gt;teststorepass&lt;/keystore.password&gt;
&nbsp;&nbsp;&lt;keystore.keypass&gt;testpass&lt;/keystore.keypass&gt;
&nbsp;&nbsp;&lt;keystore.alias&gt;testkey&lt;/keystore.alias&gt;
&lt;/properties&gt;
</pre>
<p></br></br></p>
<h3>Optimization .apk files via zipalign.</h3>
<p>The last stage of a deployment, but also very important is zipaligning the apk after it’s been signed. This aligns archived data in such a way that upon runtime memory can more efficiently store the related data. After this your apk is ready to go to the market. our configuration:</p>
<pre class="sh_xml">&lt;plugin&gt;
&nbsp;&nbsp;&lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
&nbsp;&nbsp;&lt;artifactId&gt;maven-android-plugin&lt;/artifactId&gt;
&nbsp;&nbsp;&lt;configuration&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;zipalign&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;verbose&gt;true&lt;/verbose&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;skip&gt;false&lt;/skip&gt;&lt;!-- defaults to true --&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;inputApk&gt;
&nbsp;&nbsp;&nbsp;&nbsp;${project.build.directory}/${project.artifactId}-${project.version}.apk
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/inputApk&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;outputApk&gt;
&nbsp;&nbsp;&nbsp;&nbsp;${project.build.directory}/${project.artifactId}_v${project.version}.apk
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/outputApk&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/zipalign&gt;
&nbsp;&nbsp;&lt;/configuration&gt;
&nbsp;&nbsp;&lt;executions&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;execution&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id&gt;zipalign&lt;/id&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;phase&gt;verify&lt;/phase&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goals&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goal&gt;zipalign&lt;/goal&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/goals&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/execution&gt;
&nbsp;&nbsp;&lt;/executions&gt;
&lt;/plugin&gt;
</pre>
<p></br></p>
<p>Configures the plugin for the zipalign goal and binds that goal the the ‘verify’ phase of the maven lifecycle.</p>
<h3>
<p>Real Life Example</p>
</h3>
<p>The above describes taking full control over how maven-android-plugin builds and tests your android application. In reality though, one wouldn’t really use all of the above settings in one pom. Here&#8217;s an example of a fully-configured real-life project using ALL of the above:</p>
<div>
weeworld<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&#8212; WeeWorld<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&#8212; <a href="http://gist.github.com/521029#file_pom_app.xml">pom.xml</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&#8212; WeeWorldTest<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&#8212; <a href="http://gist.github.com/521029#file_pom_test.xml">pom.xml</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&#8212; <a href="http://gist.github.com/521029#file_pom_parent.xml">pom.xml</a>
</div>
<p></br></br></p>
<p>The project makes use of a parent-child structure and maven profiles to manage both App and Instrumentation projects and handle different cases of builds. Feel free to have a look and se how we&#8217;ve done it. For more guides and tips about android development and continuous integrations check back to our blog &#8211; we&#8217;ll have something here soon!</p>
<p>Topics to expect:</p>
<div>
<ul>
<li>Project relashionships and inheritance</li>
<li>Maven profiles</li>
<li>Hudson configuration</li>
<li>Automatic instrumentation testing on many different AVD&#8217;s using Hudson Android Plugin</li>
</ul>
</div>
<p></br></br></p>
<p><H5>
<p>References:</p>
</h5>
<p><a href="http://maven-android-plugin-m2site.googlecode.com/svn/plugin-info.html">maven-android-plugin site</a>, the <a href="http://code.google.com/p/maven-android-plugin/">Getting Started</a> guide and their <a href="http://code.google.com/p/maven-android-plugin/w/list">wiki page</a>.<br />
<a href="http://maven.apache.org/plugins/maven-install-plugin/usage.html">Installing a specific file into a local maven repository</a><br />
<a href="http://code.google.com/p/maven-android-plugin/wiki/SigningAPKWithMavenJarsigner">Signing apk files with maven</a><br />
<a href="http://www.simpligility.com/2010/06/maven-android-plugin-with-zipalign-and-improved-verification/">Zipalign apk files with maven-android-plugin</a></p>
<h5>
<p>Other relevant and important resources:</p>
</h5>
<p><a href="http://www.sonatype.com/books/mvnref-book/reference/public-book.html">Maven: The complete reference book</a> and it&#8217;s <a href="http://www.sonatype.com/books/mvnref-book/reference/android-dev.html">Android Chapter</a></p>
<script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_xml.js"></script>


Share this post:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;partner=sociable" title="Print"><img src="http://novoda.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Android%20continuous%20integration%20-%20Android%20Maven%20plugin&amp;body=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F" title="email"><img src="http://novoda.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;title=Android%20continuous%20integration%20-%20Android%20Maven%20plugin&amp;bodytext=Continuous%20feedback%20on%20how%20our%20changes%20affect%20the%20current%20code%20allow%20us%20to%20confidently%20add%20%20functionality.%20Documentation%20around%20testing%20on%20the%20Android%20platform%20continuous%20or%20otherwise%20is%20scarce%20so%20here%20we%20explain%20how%20to%20continuously%20compile%20your%20Andr" title="Digg"><img src="http://novoda.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;title=Android%20continuous%20integration%20-%20Android%20Maven%20plugin&amp;notes=Continuous%20feedback%20on%20how%20our%20changes%20affect%20the%20current%20code%20allow%20us%20to%20confidently%20add%20%20functionality.%20Documentation%20around%20testing%20on%20the%20Android%20platform%20continuous%20or%20otherwise%20is%20scarce%20so%20here%20we%20explain%20how%20to%20continuously%20compile%20your%20Andr" title="del.icio.us"><img src="http://novoda.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;title=Android%20continuous%20integration%20-%20Android%20Maven%20plugin" title="Reddit"><img src="http://novoda.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Android%20continuous%20integration%20-%20Android%20Maven%20plugin%20-%20http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F" title="Twitter"><img src="http://novoda.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;title=Android%20continuous%20integration%20-%20Android%20Maven%20plugin&amp;annotation=Continuous%20feedback%20on%20how%20our%20changes%20affect%20the%20current%20code%20allow%20us%20to%20confidently%20add%20%20functionality.%20Documentation%20around%20testing%20on%20the%20Android%20platform%20continuous%20or%20otherwise%20is%20scarce%20so%20here%20we%20explain%20how%20to%20continuously%20compile%20your%20Andr" title="Google Bookmarks"><img src="http://novoda.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;t=Android%20continuous%20integration%20-%20Android%20Maven%20plugin" title="Facebook"><img src="http://novoda.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;t=Android%20continuous%20integration%20-%20Android%20Maven%20plugin" title="HackerNews"><img src="http://novoda.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F" title="Technorati"><img src="http://novoda.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fnovoda.com%2F2010%2F08%2F13%2Fandroid-continuous-integration-android-maven-plugin%2F&amp;partner=sociable" title="PDF"><img src="http://novoda.com/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://novoda.com/2010/08/13/android-continuous-integration-android-maven-plugin/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Extending Android&#8217;s shell with BusyBox</title>
		<link>http://novoda.com/2008/11/12/extending-androids-shell-with-busybox/</link>
		<comments>http://novoda.com/2008/11/12/extending-androids-shell-with-busybox/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 01:40:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[busybox]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.novoda.com/blog/?p=3</guid>
		<description><![CDATA[A vanilla android installation is a bare bones affair aimed solely at the mobile device. This comes at the initial expense of our development environment. This platform is only intended for only the smallest devices and so searching amoungst 'system/bin' reveals only a cherry picking of Linux system administrator staples, even the most common binaries such as 'ls', 'mv' and 'rm' have been stripped of all but their essential options and recompiled. Installing third party tools on Android offers a range of additional productive tools and options for ease of development within the Android shell.]]></description>
			<content:encoded><![CDATA[<p>A vanilla android installation is a bare bones affair aimed solely at the mobile device. This comes at the initial expense of our development environment. This platform is only intended for only the smallest devices and so searching amongst &#8216;<em>system/bin</em>&#8216; reveals only a cherry picking of Linux system administrator staples, even the most common binaries such as &#8216;<em>ls</em>&#8216;, &#8216;<em>mv</em>&#8216; and &#8216;<em>rm</em>&#8216; have been stripped of all but their essential options and recompiled. Installing third party tools on Android offers a range of additional productive tools and options for ease of development within the Android shell.</p>
<h2>Android shell</h2>
<p>Invoking the android emulator from within an IDE is the ideal setup but developers will find need to interact with the emulator through other means for scripting, integration testing and just practical reasons. The SDK tools are located in the tools directory and I&#8217;d recommend regular users of the sdk to add this directory to their shell&#8217;s export path.</p>
<p>I develop on a mac so I have added the <em>android-sdk-mac_x86-1.0_r1/tools</em> to my <em>.profile</em> but you could equally add it to your <em>.bashrc</em> or <em>.kornrc</em> within your user&#8217;s home area giving you convenient direct access to all of android&#8217;s development tools via the binary names such as $adb, $emulator or $ddms. If you are on a windows machine these variables would instead be set via your system settings -&gt; environment variables.</p>
<p>With the tools on the shells $PATH, the emulator can now be invoked:</p>
<pre class="sh_sh">
$emulator
</pre>
<p>Now to telnet to the running device image:</p>
<pre class="sh_sh">
$adb shell
</pre>
<h2>BusyBox</h2>
<p><a href="http://www.busybox.net/">BusyBox</a> is a single multicall binary that packages the functionality of many popular standard Unix tools. The aim of the BusyBox project is to keep the total package size overhead as small as possible by sharing  commonly used gnu libC libraries via a single set of ELF headers and stripping down gnu&#8217;s libc so as only to provide the functions necessary to support Busybox and the other executables.</p>
<h3>Side note &#8211; Standing up for GNU with legal action</h3>
<p>Busybox author&#8217;s have gained a reputation for their commendable efforts to uphold the <a href="http://www.oss-watch.ac.uk/resources/gpl.xml">legal rights of the GNU public license</a> as they have brought about court action as plaintiffs on a series of cases where they believed companies were not holding to the terms of GNU public license. Companies they have appealed against include Verizon, High-Gain Antennas and Xterasys. Most notably they are commonly credited with the first GNU public licence related court action <a href="http://www.softwarefreedom.org/news/2007/sep/20/busybox/">against Monsoon Multimedia</a> for their use of BusyBox within it&#8217;s <a href="http://www.myhava.com/index.html">HAVA</a> streaming video software (Hava have since made their alterations available). So far all cases have been settled before they reached the court.</p>
<h2>Installing busy box <span>on Android</span></h2>
<p>It is common place for developers to check out the source of BusyBox and compile a tailor made build with any preferred tools and options. There are others like myself who just use whatever they can find and I have settled with a build generously donated with the intent of android deployment by Ben Leslie available from both <a href="http://benno.id.au/blog/2007/11/14/android-busybox">his site</a> and the <a>run buddy code wiki</a>.</p>
<p>First aquire your build and then add it to the running android device like so:</p>
<pre class="sh_sh">
$adb shell mkdir /data/busybox
$adb push busybox /data/busybox
$adb shell
</pre>
<p>Now within the android Emulator shell:</p>
<pre class="sh_sh">
$cd /data/busybox
$chmod 775 busybox
$./busybox –install
</pre>
<p>Now you have installed BusyBox!</p>
<p>For ease of use I would add this to the shell&#8217;s $PATH</p>
<pre class="sh_sh">
export PATH=/data/busybox:$PATH
</pre>
<p>Now invoking busybox will reveal all your new commands!</p>
<pre class="sh_sh">
$busybox
</pre>
<p>Some highlights of this particular binary of BusyBox are:<br />
<strong>chown, chgrp</strong>: change permission ownership.<br />
<strong>awk, sed</strong>: languages to both process &amp; transform text<br />
<strong>grep</strong>: a text search utility<br />
<strong>du</strong>: shows disk usage<br />
<strong>vi</strong>: a shell based text editor<br />
<strong>pidof</strong>: return the pid of a running process<br />
<strong>less</strong>: text reader with back and forward nav<br />
<strong>tail</strong>: trail the end of a file for activity<br />
<strong>gunzip, gzip, tar, bzip2</strong>: archival compression software<br />
<strong>clear</strong>: clear screen<br />
<strong>crontab, crond</strong>: task scheduling<br />
<strong>diff</strong>: compare files<br />
<strong>httpd</strong>: a light webserver<br />
<strong>telnet</strong>: basic TCP remote login<br />
<strong>xargs</strong>: use the output of a command as the arguments for another<br />
<strong>su</strong>: masquerade as another system user<br />
<strong>wget</strong>: retrieves content from a web server<br />
<strong>which</strong>: identifies the location of an executable<br />
For info on these or any linux commands check the <a href="http://man.he.net/">man pages online</a>.</p>
<p>Have I missed any of your shell essentials? If you have any BusyBox builds for Android then we&#8217;d love to hear about how you are using them in your development environment.</p>
<blockquote><p>Android SDK at time of writing was: <strong>android-sdk-mac_x86-1.0_r1</strong></p></blockquote>
<h3>Citations &amp; Research</h3>
<ul>
<li><cite><a href="http://www.busybox.net/">http://www.busybox.net/</a></cite></li>
<li><cite><a href="http://www.busybox.net/downloads/BusyBox.html">Official Busy box documentaion</a></cite></li>
<li><cite><a href="http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/">Busy box Source code repository</a></cite></li>
<li><cite>I sourced the build of BusyBox from <a href="http://benno.id.au/blog/2007/11/14/android-busybox">Ben Leslie&#8217;s site</a> &#8211; Thanks!</cite></li>
<li><cite><a href="http://www.ibm.com/developerworks/library/l-busybox/">BusyBox article on dev works by M. Tim Jones</a></cite></li>
<li><cite><a href="http://www.linuxdevices.com/files/article018/00load.html">An Animated guide to BusyBox</a></cite></li>
<li><cite><a href="http://blogs.zdnet.com/open-source/?p=1837">Busybox takes another step up GPL protection ladder</a><cite></cite></cite></li>
<li><cite><a href="http://news.cnet.com/8301-13505_3-9831376-16.html?tag=mncol;title">GPL lawsuits: A reason to rejoice(?), not panic</a><cite></cite></cite></li>
<li><cite><a href="http://blogs.zdnet.com/open-source/?p=2511">Do the Busybox cases change anything?</a><cite></cite></cite></li>
</ul>
<script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_sh.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_sh.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_sh.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_sh.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_sh.js"></script><script type="text/javascript" src="/wp-content/plugins/shjs-syntax-hiliter/shjs/lang/sh_sh.js"></script>


Share this post:


	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F&amp;partner=sociable" title="Print"><img src="http://novoda.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="mailto:?subject=Extending%20Android%27s%20shell%20with%20BusyBox&amp;body=http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F" title="email"><img src="http://novoda.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<img src="http://novoda.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<img src="http://novoda.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F&amp;title=Extending%20Android%27s%20shell%20with%20BusyBox" title="Reddit"><img src="http://novoda.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Extending%20Android%27s%20shell%20with%20BusyBox%20-%20http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F" title="Twitter"><img src="http://novoda.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<img src="http://novoda.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F&amp;t=Extending%20Android%27s%20shell%20with%20BusyBox" title="Facebook"><img src="http://novoda.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F&amp;t=Extending%20Android%27s%20shell%20with%20BusyBox" title="HackerNews"><img src="http://novoda.com/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://technorati.com/faves?add=http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F" title="Technorati"><img src="http://novoda.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fnovoda.com%2F2008%2F11%2F12%2Fextending-androids-shell-with-busybox%2F&amp;partner=sociable" title="PDF"><img src="http://novoda.com/wp-content/plugins/sociable/images/pdf.png" title="PDF" alt="PDF" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://novoda.com/2008/11/12/extending-androids-shell-with-busybox/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

