app development with the ubuntu emulator

14
App development with the Ubuntu emulator David Planella @ Ubuntu Online Summit, June 2014

Upload: david-planella

Post on 09-May-2015

259 views

Category:

Mobile


2 download

DESCRIPTION

Learn how to use the Ubuntu emulator for touch devices to develop your apps close to a real environment, but without the need of a device. Watch the video at http://youtu.be/z7v_N2fKuP0

TRANSCRIPT

Page 1: App development with the Ubuntu emulator

App development with the Ubuntu emulator David Planella @ Ubuntu Online Summit, June 2014

Page 2: App development with the Ubuntu emulator

> emulator basics

Page 3: App development with the Ubuntu emulator

(c) 2013 Canonical

The Ubuntu emulator> Emulates a physical device on software, running Ubuntu on top

> Thus it's "just another device"

> Intended to become a primary Engineering platform for development

> Supported architectures: x86 (desktop), armhf (touch)

> Can be executed independently or integrated with the SDK

> On a 10,000 ft view, the emulator is:

> The ubuntu-emulator tool and its management commands

> The emulator UI, running Ubuntu in phone mode

> The integration with Ubuntu’s IDE for app development

Emulator basics

Page 4: App development with the Ubuntu emulator

(c) 2013 Canonical

Installing the Ubuntu emulator> Available for Ubuntu 14.04 or later

> Assuming the SDK is already installed:

> http://developer.ubuntu.com/start/

> Standalone installation

sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update

sudo apt-get install ubuntu-emulator

Emulator basics

Page 5: App development with the Ubuntu emulator

(c) 2013 Canonical

Creating emulator instances> Recommended: create emulator instances with i386 architecture for faster

native speeds

> On the IDE

> Go to the Devices tab and press +

> On the CLI

> sudo ubuntu-emulator create myemu --arch=i386

> The SDK also detects manually-created emulators

Emulator basics

Page 6: App development with the Ubuntu emulator

(c) 2013 Canonical

Running emulator instances> Requires an existing emulator installation

> On the IDE

> Go to the Devices tab and pick an existing emulator

> Press the green Play button

> On the CLI

> ubuntu-emulator run myemu

> Try the --scale and --memory parameters too

> The SDK also detects manually-started emulators

> Caveats

> Network works transparently via the host's connection

> Apps scope shows only arch-independent or the emulator's arch’s apps

Emulator basics

Page 7: App development with the Ubuntu emulator

(c) 2013 Canonical

Upgrading emulator instances> System-image-based upgrades are in the works

> To upgrade an emulator installation

> First destroy, then re-create

Emulator basics

Page 8: App development with the Ubuntu emulator

(c) 2013 Canonical

Talking to the emulator> The emulator is just another device: use regular ADB or SSH to connect

> On the IDE

> Go to the Devices tab, and pick a running emulator

> Click on its Advanced tab, choose the option to open a SSH connection

> On the CLI

> Use e.g. adb shell or connect directly via SSH

Emulator basics

Page 9: App development with the Ubuntu emulator

> app dev with the emulator

Page 10: App development with the Ubuntu emulator

(c) 2013 Canonical

Using the emulator for app development> Real-world example app: Reminders

> Complex app, exercises key parts of the Ubuntu app dev ecosystem

> Multi-arch: can be built both on armhf and x86

> Convergent app: uses Ubuntu.Layouts for different UX

on desktop/tablet and phone

> Uses networking to communicate with a 3rd-party service (Evernote)

> Uses platform APIs: Online Accounts and Content Hub

App development with the emulator

Page 11: App development with the Ubuntu emulator

(c) 2013 Canonical

Development kits> The Ubuntu IDE groups settings for building and running apps as

kits to ease cross-platform development

> Each kit consists of a group of settings that define an environment

(e.g. compiler, device, debugger, etc.)

> Kits can be selected or switched on and off for each project

> In a nutshell, kits are the combination of a toolchain and a device

App development with the emulator

Page 12: App development with the Ubuntu emulator

(c) 2013 Canonical

Main kit elements> The device: emulator

> The toolchain: build chroot (for the same architecture)

> Workflow

> Create chroot (toolchain) on the IDE or on the CLI

sudo click chroot --architecture i386 --framework ubuntu-sdk-14.10 create

> Create an emulator (device)

> Create a kit from the Devices tab and edit it if necessary

> Open a project and assign kit the new kit to it

> Build, run and profit!

App development with the emulator

Page 13: App development with the Ubuntu emulator

(c) 2013 Canonical

Running apps on the emulator> Unconfined

> Easiest way to run the app on the device

> Logs and debugging available from the IDE

> Simply press the Play button

> But not recommended for production testing

> Confined

> Implies building a click package and installing it

> Closest to running in production

> But no live debugging capabilities yet

App development with the emulator

Page 14: App development with the Ubuntu emulator

Thank youandstay in touch!

> David Planella <[email protected]>

> +DavidPlanella · @dplanella

> developer.ubuntu.com

> @ubuntuappdev

> gplus.to/ubuntuappdev

> facebook.com/ubuntuappdev