Android developer's toolbox

Post on 10-May-2015

2,008 views 1 download

Tags:

transcript

Android developer toolbox

Alex Verdyan@aexxx

Agenda

Build tools ant, maven

Libraries Roboguice, retrofit, ormlite,

androidannotatations, Testing

Fonemonkey, robolectric, robotium solo Stuff

acra, bugsense,

Build outside IDE (for CI)

Ant

Pros developed by Google (Android tools

team) Gets all the latest SDK improvements Generated from Eclipse (ADT)Cons No dependency management ( needs

Ivy) Not trivial to contribute (or debug) Ant…

Maven (android-maven-plugin)

founded by JAYWAY developed by the community Hosted on github – easy to contribute/debug

Easy to setup Dependency management

Jars depend on other jars with versions Supports

package (apk/apklib), jar sign, zipalign, proguark, native, scala and more

Runs tests start emulator prior to running test

Maven (android-maven-plugin) Use Maven profiles to distinguish dev from

release build

Libraries

roboguice

Based on Google Guice Simplify your code make it more

readable Remove boilerplate

PLUS: You get the power of dependency injection (Guice) Automatic Injection Loose coupling Testing with Mocks

roboguice

roboguice

Retrofit

Re-usabale library by Square Inc. Interesting stuff

RestAdapter – abstraction over HTTP for Android▪ Create a Java interface for your services

ShakeDetector QueueFile (for storing a Q on Android

filesystem)

Retrofit - RestAdapter

Does all the dirty HTTP work for you All calls are Async

can be used from UI thread w/ callback Built-in JSON support

Uses JdkProxy, Guice and Gson

Retrofit – RestAdapte (cont.)

ORM Lite

Lightweight ORM Makes DB interaction more pleasant Code more readable Mature project Good documentation + large

community Excellent support from the project

owner Grey Watson http://256.com/gray/

ORM Lite - Entities

DatabaseHelper

DatabaseHelper (cont)

DatabaseHelper (cont)

Android annotations

Provides Android specific annotations to make the code even more readable

Can be integrated with roboguice Works by generating code during

build process

Android annotations

Android annotations

Testing

FoneMonkey

Relatively new (4-6 month) Backed up by commercial firm (Gorilla

Logic) Record your tests Adjust playback speed Add conditions Generate JUnit from the recording Tests can run as plain JUnit (it

communicates with the app inside emulator)

* very elegant solution for test recording

FoneMonkey

FoneMonkey

Robotium Solo

Selenium like UI + Functional testing framework

Runs on Emulator/Device

Robotium Solo - Example

Robolectric

You can run tests from IDE No emulator Fast Enables TDD No mocking framework needed

http://github.com/pivotal/robolectric

Robolectric

Run tests from IDE Very fast No emulator Intercepts loading of Android classes

– rewriting their bodies to return null/0/false

Or forward calls to shadow classes

Shadow class

Example

Stuff

Project Template

Starting new Android project? Here’s Intellij project template with

configured: roboguice robolectric C2DM Android source jars Jackson (json parser) ….

https://github.com/pivotal/AndroidIntelliJStarter

Error reporting - ACRA

Library that submits crash reports (or exceptions) to your server / Google spreadsheet / email

Add logcat and memory usage to your report

Mature project Used by lots of apps (incl. Facebook

app) OSS

Error reporting - BugSense

Bug tracking for mobile Realtime crash / bugs analytics Search Notify users when bug is fixed Supports Proguard Integrates with ACRA and JIRA

Error reporting - BugSense

Error reporting – Jira Mobile Connect

Post crashes/bugs as tickets in JIRA Still in development Open source Cool features

Get user feedback Reply to user via comment on JIRA issue Notify user the crash/bug he reported is

fixed and more…

We’re looking for talented developers

Any.DO

Thank you