54
Mobile Development Tools and Practices Arnaud Héritier eXo Platform @aheritier Wednesday, December 14, 11

Mobile developments at eXo

Embed Size (px)

DESCRIPTION

Tools and processes used at eXo to develop our mobile applications (iOS & Android) including continuous integration and deployment. Tips and tricks to setup all the infrastructure involved in them.

Citation preview

Page 1: Mobile developments at eXo

Mobile Development Tools and Practices

Arnaud HéritiereXo Platform@aheritier

Wednesday, December 14, 11

Page 2: Mobile developments at eXo

Our Motivation

• Observations

• eXo Mobile division had many difficulties to stabilize applications (build failures, dependencies to the development environment ...),

• Functional and technical feedbacks were very limited because the deployment/update process was complex for testers / early adopters.

Wednesday, December 14, 11

Page 3: Mobile developments at eXo

Our Motivation

• Prescription

• Continuous build and deployment of mobile applications (iOS, Android)

• to speedup the feedback loop

• to increase the number of testers / early adopters

• to increase the quality and the stability of these applications.

Wednesday, December 14, 11

Page 4: Mobile developments at eXo

Our Motivation

• CI wasn't easy to setup the first time, especially for iOS. The experience is worth being shared.

Wednesday, December 14, 11

Page 5: Mobile developments at eXo

Webinar Schedule

• The development environment

• Setup the continuous integration

• Setup the continuous deployment

Wednesday, December 14, 11

Page 6: Mobile developments at eXo

Environment overviewWednesday, December 14, 11

Page 7: Mobile developments at eXo

The Development Environment for iOS

Wednesday, December 14, 11

Page 8: Mobile developments at eXo

iOS Development Toolbox

• Xcode

• http://developer.apple.com/xcode/

Wednesday, December 14, 11

Page 9: Mobile developments at eXo

Setup a Development Environment for iOS

• Apple documentation

• http://goo.gl/Ge13t

• The most important part is to register your Apple developer account and to correctly set your code signing identity

Wednesday, December 14, 11

Page 10: Mobile developments at eXo

CertificatesWednesday, December 14, 11

Page 11: Mobile developments at eXo

ProvisioningWednesday, December 14, 11

Page 12: Mobile developments at eXo

Setup a Development

Environment for iOS

The developer can spend the major part of the day in Xcode and the emulator as long as the code is regularly committed in

the SCM

Wednesday, December 14, 11

Page 13: Mobile developments at eXo

The Development Environment for

Android

Wednesday, December 14, 11

Page 14: Mobile developments at eXo

• Java JDK

• http://www.oracle.com/technetwork/java/javase/downloads/index.html

• Android SDK

• http://developer.android.com/sdk

• Eclipse 3.7 IDE for Java Developers

• http://eclipse.org

• Apache Maven

• http://maven.apache.org/

Android Development Toolbox

Wednesday, December 14, 11

Page 15: Mobile developments at eXo

Setup a Development Environment for Android• Installation

• Java JDK

• Android SDK

• Don’t forget to set the ANDROID_HOME environment variable

• Maven 3.0.3 min

• Required by the 3.0 version of the android plugin

• Eclipse

• Use Java Developers edition with its Maven integration (m2e)

• Don’t forget to configure your Maven and ADT paths in eclipse settings.

Wednesday, December 14, 11

Page 16: Mobile developments at eXo

Maven installation path to use in eclipse

Wednesday, December 14, 11

Page 17: Mobile developments at eXo

ADK installation path to use in eclipse

Wednesday, December 14, 11

Page 18: Mobile developments at eXo

Maven POM for an Android Project

• Packaging = apk

• Uses the plugin com.jayway.maven.plugins.android.generation2:android-maven-plugin

• version 3.0.0 min

• manifest-update goal bound to the phase process-resources

Wednesday, December 14, 11

Page 19: Mobile developments at eXo

Setup a Development Environment for Android• Just import your Maven/APK project in eclipse with m2e.

• M2e and its market place will automatically install and configure the Android extension in eclipse

• You’ll be able to manage your project dependencies with Apache Maven

• You don’t have to explicitly use Maven in your development process. M2e does the necessary to hide it.

• Manage your Android project with Apache Maven

• http://www.sonatype.com/books/mvnref-book/reference/android-dev.html

• http://code.google.com/p/maven-android-plugin/

Wednesday, December 14, 11

Page 20: Mobile developments at eXo

Maven POM for an android

project

Wednesday, December 14, 11

Page 21: Mobile developments at eXo

Setup a Development

Environment for Android

The developer can spend the major part of the day in Eclipse and the emulator as long as the code is regularly committed in

the SCM

Wednesday, December 14, 11

Page 22: Mobile developments at eXo

Continuous Integration Environment

Wednesday, December 14, 11

Page 23: Mobile developments at eXo

Continuous Integration Toolbox

• Jenkins

• http://jenkins-ci.org/

• Java JDK

• http://www.oracle.com/technetwork/java/javase/downloads/index.html

• Android SDK

• http://developer.android.com/sdk

• Apache Maven

• http://maven.apache.org/

• Xcode

• http://developer.apple.com/xcode/

Wednesday, December 14, 11

Page 24: Mobile developments at eXo

Continuous Integration for iOS

• Jenkins with the Xcode plugin

• https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin

• Requires a MacOS platform to build (using a Jenkins agent if necessary)

Wednesday, December 14, 11

Page 25: Mobile developments at eXo

Continuous Integration for iOS

• Configure the environment where build will be run as a development environment (Xcode + certificates)

• Connect your Jenkins Server to an iOS agent :

• Use a dedicated user account on the agent host,

• Allow Remote Login (Sharing preferences) on the agent to connect to it using SSH,

• Configure an SSH key on the Server that you will authorize on the agent (~/.ssh/authorized_keys)

Wednesday, December 14, 11

Page 26: Mobile developments at eXo

Dedicated account for Jenkins agent on Macos X host

Wednesday, December 14, 11

Page 27: Mobile developments at eXo

Activate Remote Login (aka SSH)

Wednesday, December 14, 11

Page 28: Mobile developments at eXo

Continuous Integration for iOS

• Create a freestyle job in jenkins with an Xcode Build Step

• Ask to build the IPA

• Configure it to unlock the login keychain

• Use build variables to generate a unique technical version

Wednesday, December 14, 11

Page 29: Mobile developments at eXo

Continuous Integration for iOS

• “User interaction is not allowed” error returned while signing your binary ?

• Launch one time manually the build on the agent to validate permanently the access to the keychain for the process “codesign”

Wednesday, December 14, 11

Page 30: Mobile developments at eXo

Continuous Integration for Android

• Install an Android SDK on all agents where the android job can be launched

• Configure in Jenkins

• JDK 1.6+

• Apache Maven 3.0.3+

• ANDROID_HOME environment variable or define the property android.sdk.path in a profile activated from maven settings.xml configuration file.

Wednesday, December 14, 11

Page 31: Mobile developments at eXo

Continuous Integration for Android

• Create a Maven Job

• Use the property “android.manifest.versionCode” to inject a unique version number in the application Manifest

Wednesday, December 14, 11

Page 32: Mobile developments at eXo

Continuous Deployment Environment

Wednesday, December 14, 11

Page 33: Mobile developments at eXo

Continuous Deployment Toolbox

• Jenkins

• http://jenkins-ci.org/

• Appaloosa Store

• http://appaloosa-store.com

Wednesday, December 14, 11

Page 34: Mobile developments at eXo

Private Store

• Appaloosa allow you to manage a private store for Android or iOS devices

• Even if our applications are deployed in public app-stores after the release we rely on a private app-store to easily deploy tests versions to our QA or our early adopters.

Wednesday, December 14, 11

Page 35: Mobile developments at eXo

Continuous Deployment with Appaloosa

• Install the appaloosa plugin in Jenkins

• https://wiki.jenkins-ci.org/display/JENKINS/Appaloosa+Plugin

• Get the organization token in the administration panel of your appaloosa store

• Create a private store for each system : One for iOS and one for Android

• Configure in each job a post build task to deploy binaries

• **/*.ipa for the iOS build

• **/target/*(-aligned).apk for the android build

Wednesday, December 14, 11

Page 36: Mobile developments at eXo

Continuous Deployment with Appaloosa

• Check your emails and install the Appaloosa Store App or open the website on your mobile.

• Both of them will warn you about the availability of a new version of your application.

• Just install/update it

Wednesday, December 14, 11

Page 37: Mobile developments at eXo

FULL SCENARIO

Wednesday, December 14, 11

Page 38: Mobile developments at eXo

FULL SCENARIOWednesday, December 14, 11

Page 39: Mobile developments at eXo

iOS developmentWednesday, December 14, 11

Page 40: Mobile developments at eXo

Jenkins pluginsWednesday, December 14, 11

Page 41: Mobile developments at eXo

Xcode build configuration in Jenkins for iOS jobs

Wednesday, December 14, 11

Page 42: Mobile developments at eXo

Post-build configuration for iOS Jobs in Jenkins

Wednesday, December 14, 11

Page 43: Mobile developments at eXo

Let’s launch the iOS jobbuild

Wednesday, December 14, 11

Page 44: Mobile developments at eXo

iOS build outputWednesday, December 14, 11

Page 45: Mobile developments at eXo

iOS post-build outputWednesday, December 14, 11

Page 46: Mobile developments at eXo

iOS job pageWednesday, December 14, 11

Page 47: Mobile developments at eXo

We receive a notification

from Appaloosa(using the private store

application)

Wednesday, December 14, 11

Page 48: Mobile developments at eXo

Notification sticker on our Appaloosa

store app

Wednesday, December 14, 11

Page 49: Mobile developments at eXo

In the application detail screen we

can see the update

Wednesday, December 14, 11

Page 50: Mobile developments at eXo

Application installation or

update

Wednesday, December 14, 11

Page 51: Mobile developments at eXo

Application installation or

update

Wednesday, December 14, 11

Page 52: Mobile developments at eXo

It’s ready !

Wednesday, December 14, 11

Page 53: Mobile developments at eXo

Enjoy

Wednesday, December 14, 11

Page 54: Mobile developments at eXo

Q/A ?

Wednesday, December 14, 11