Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Continuous Integration with Maven for Android apps

on

  • 7,810 views

Why Maven can be relevant for building Android applications, and how a complete Jenkins server can be set up for building and running tests on Android applications. ...

Why Maven can be relevant for building Android applications, and how a complete Jenkins server can be set up for building and running tests on Android applications.

Installation script for the Jenkins server is at http://github.com/hugojosefson/jenkins-with-android

Statistics

Views

Total Views
7,810
Views on SlideShare
7,711
Embed Views
99

Actions

Likes
8
Downloads
129
Comments
0

4 Embeds 99

http://lanyrd.com 82
http://confluence.makingwaves.no 15
http://confluence 1
http://iutility.blogspot.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Yes, there are notes for some slides :)
  • You find+download jars, what are they named? Sometimes/Usually not w/ version numbers. Git/Svn not designed for multi-MB binary blobs. The history becomes heavy. (affects backups for svn,git; clone for git) Where can I find dependency information? Hopefully in “some documentation” on each jar's website.
  • How do you keep track of which version of the common lib you are using? (in each of the apk projects)
  • Customer says: “Doesn't work!” Developer says: “Works for me!” How do you know what each person is using, if the build server built the app one way and the developer some other way?
  • Let me show you what Maven and a Continuous Integration server can bring to the table, addressing each of these issues... But first, what is Maven?...
  • - It's more than a build tool, because it lets you define the project in terms of /what it is/ rather than defining /all the build steps/ needed to arrive at the output artifact. – You define your project in a project object model (pom file), where you tell Maven what the packaging type of your application is: jar, war, apk. It then knows what build steps are needed to build your project and where your code and resources are located by default.
  • – You can override the defaults if you want.
  • – Plugins contain the functionality: built-in core plugins for default things such as compiling a jar, and 3:rd party such as maven-android-plugin for building Android apk:s.
  • Maven downloads this from a Central OpenSource repository. - cached locally - If what you need is not already there, you can have your own repository where you store 3:rd party jars.
  • – In this case, the Library is a simple jar project, containing the main functionality. It's not tied to a particular platform, and is unit-testable. – The App project is an apk, and uses the Library via Maven dependency declaration.

Continuous Integration with Maven for Android apps Continuous Integration with Maven for Android apps Presentation Transcript

  • Continuous Integration (CI) with Maven for Android applicationsHugo Josefson @ GTUG Malmö 2011
  • Agenda● Whats the problem? ● Maven & CI – Dependency management – Dependency management – Developer / – Developer / Build server mismatch Build server mismatch – Running tests – Running tests● DEMO! – How to set up Android apps for Maven – How to set up Android tests for Maven – How to set up Continuous Integration
  • Whats the problem?
  • Whats the problem? - Dependency management• External jars • Hunt down the jars • Where to store them? (svn/git? non-optimal!) • What version was this jar? • What version of other dependency jars does it work with? – all handled manually
  • Whats the problem? - Dependency management• Inter-project dependencies • common library jar – our-common-lib.jar • several apk projects depend on it – MyApp1.apk – MyApp2.apk
  • Whats the problem?- Developer / Build server mismatch• Script vs IDE for building – Is the binary built the same way across developers and build servers?• Script vs IDE for testing – Is the binary tested the same way across developers and build servers?
  • Whats the problem? - Running tests• Common excuses – "I dont have time for tests before commit!" – "I cant be bothered with tests before commit!" – “I forgot...”• Regressions creep in...
  • Maven
  • What is Maven?• A build tool (and more: bit.ly/whatIsMaven)• Default directory structure – overridable• Plugins
  • Maven as Build Tool• Tell Maven: – My project is a jar / war / apk / ... – I need library jar commons-lang:2.5• Maven knows how to build that• Maven knows how to fetch libraries• (No need to specify directories, nor handle library jars)
  • MavenDefault Directory Structure
  • Maven Plugins• Built-in for core functionality – Building jar – Building war – JavaDoc – Running Tests – … lots more• Extra for e.g. building / testing / deploying apk – maven-android-plugin
  • Maven vs Dependency management• External jars → Dependency declaration <dependency> <groupId>commons-lang</groupId> <artifactid>commons-lang</artifactId> <version>2.5</version> </dependency>
  • Maven vs Dependency management• Inter-project dependencies → Dep. declaration – Example: morse-lib by Manfred Moser
  • Maven vsDeveloper / Build server mismatch• Solved when both use same build and test tool – Build server can use Maven – Developer can use Maven – Maven builds and runs tests in one go – Reproducible → Same build result
  • DEMO TIME!
  • How to set upAndroid apps for Maven [DEMO]
  • How to set upAndroid tests for Maven [DEMO]
  • How to set upContinuous Integration [DEMO] Jenkins + Android SDK Android Emulator Plugin Maven project
  • Maven Android resources Getting Started + discussion group: http://code.google.com/p/maven-android-pluginGoogle: maven android Questions?
  • Extra stuff(if time allows)
  • Robotium• Write UI tests for Android easily with Robotium – www.robotium.org – Standalone jar (Apache License 2) – Makes it easier to write instrumentation tests – Handles all the hard stuff: – Toasts, Context menus, Timing issues, following current Activity...
  • Robotium, contd...• Write UI tests for Android easily with Robotium – www.robotium.org – Use normal instrumentation test class, e.g. ActivityInstrumentationTestCase2 – Some Maven-enabled robotium-samples git clone --recursive git://github.com/jayway/robotium-samples.git
  • Multi-module projects• Share code & resources between Android apps – Share code + Java resources → Dependency to jar – Share Android resources → Dependency to apklib » ApkLib on maven-android-plugin wiki » libraryprojects/ in Samples (beta)