rationalizing android development - bed-con · 2016. 1. 15. · android’s default set of tools...

40
Rationalizing Android Development Philipp Kumar

Upload: others

Post on 21-Feb-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Rationalizing Android Development

Philipp Kumar

Page 2: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Who am I?

Philipp Kumar

akquinet tech@spree GmbH Mobile Solutions Focus: Android and its Enterprise Integration

Page 3: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Java / JEE

Consulting

Development

Integration

JBoss

OSGiUI Design

Web PortalsModular Systems

Trainings

Mobile Systems

Android

Open Source

User Experience

Who are we?

Page 4: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Who are you?

?415.04.2011Copyright © 2011 – akquinet AG

Page 5: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Rationalize

Simplicity

QualityMaintain-

ability

Rationalization?

Page 6: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android
Page 7: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Android’s default set of tools

What we have…

Android SDK

Compiler, Packager, Emulator, …

Eclipse Plugin

Android IDE

Page 8: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Now imagine…

… more complexity.

One screen -> Multitude of screens Offline app -> Server interaction Java only -> Java plus native C/C++ components Foreground only -> Background tasks/services 10 Lines of Code -> >10000 Lines of Code …

Page 9: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android
Page 10: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Default Set of Tools

Again, what we have…

Android SDK

Compiler, Packager, Emulator, …

Eclipse Plugin

Android IDE

Page 11: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Default Set of Tools

Again, what we have…

Android SDK

Compiler, Packager, Emulator, …

Eclipse Plugin

Android IDE

insufficient…

Page 12: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Default Set of Tools

Again, what we have…

Android SDK

Compiler, Packager, Emulator, …

Eclipse Plugin

Android IDE

insufficient…why?

Page 13: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Requirements

Correctness

testable, consistent, market-ready

Portability

address Android fragmentation

Maintainability

simple ↔ comprehensible → changeable/extensible

1315.04.2011Copyright © 2010 – akquinet AG

Page 14: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

1415.04.2011Copyright © 2011 – akquinet AG

Requirements

Page 15: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Build Process

Page 16: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Build from IDE

Easy

but …

Platform-dependent Non-reproducible Error-prone

Cannot be automated

1615.04.2011Copyright © 2011 – akquinet AG

Page 17: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Build using Ant

Can be automated Reproducible

but …

No standardized build process No dependency management Maintenance nightmare

1715.04.2011Copyright © 2011 – akquinet AG

Page 18: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Solution: Use Maven!

1815.04.2011Copyright © 2011 – akquinet AG

Standardized

Descriptive

DependencyManagement

Release Process

Modular

Page 19: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Modularize with Maven

Divide your Android projects into smaller projects

Subprojects can depend on

Ordinary Java projects

Android projects

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

https://github.com/akquinet/android-rindirect

1915.04.2011Copyright © 2011 – akquinet AG

+ maven-rindirect-plugin

Page 20: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Real-world modularization

2015.04.2011Copyright © 2011 – akquinet AG

Page 21: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Logging

Logging

2115.04.2011Copyright © 2011 – akquinet AG

Page 22: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Logging

What Android provides

Logging mechanism

Different log levels

Log level can be set at runtime (per-device)

Requires appropriate rights!

What we needed

Per default, do not log anything!

Enable/configure logging at runtime if needed

Configure logging per app

2215.04.2011Copyright © 2011 – akquinet AG

Page 23: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Use Androlog for logging

androlog framework

Wrapper on top of Android‘s Log system

Enable/disable logging

Configure loglevel

Open-source

https://github.com/akquinet/androlog

2315.04.2011Copyright © 2011 – akquinet AG

Page 24: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Behind the scenes

Reporting

2415.04.2011Copyright © 2011 – akquinet AG

Page 25: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Reporting

What Android 2.2 provides

„Send report“ prompt on error

Report contains

Exception stack trace

Custom user message

=> Insufficient

2515.04.2011Copyright © 2011 – akquinet AG

Page 26: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Reporting

What we needed

Pre-Android-2.2 reporting!

Report context information

Report device information

2615.04.2011Copyright © 2011 – akquinet AG

Page 27: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Reporting

Androlog… again

Catch exceptions and send a more detailed report containing log messages

containing device info

Send reports via

Email

HTTP Post

… extendable

https://github.com/akquinet/androlog

2715.04.2011Copyright © 2011 – akquinet AG

Page 28: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Behind the scenes

Integration Testing

2815.04.2011Copyright © 2011 – akquinet AG

Page 29: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Integration Testing

Automatically test the whole app on a device or emulator

Supported in Android via Instrumentation

Start application under test…

… deliver events…

… and define assertions on resulting behavior.

2915.04.2011Copyright © 2011 – akquinet AG

Page 30: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android
Page 31: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Integration Testing

Marvin: Android Test Framework

Control Activities and Services

Define Assertions

Inject events

Ease writing and maintenance of tests

https://github.com/akquinet/android-marvin

3115.04.2011Copyright © 2011 – akquinet AG

Page 32: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Behind the scenes

Continuous Integration

3215.04.2011Copyright © 2011 – akquinet AG

Page 33: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Continuous Integration

Continuous Integration

Build the app on a dedicated server

Build automatically after every commit

Test by automatically starting emulators

… and run tests covering all Android versions

Send mails immediately on build/test failure

Build nightly beta versions

We use

Hudson/Jenkins + Android plugin

3315.04.2011Copyright © 2011 – akquinet AG

Page 34: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Behind the scenes

Release Process

3415.04.2011Copyright © 2011 – akquinet AG

Page 35: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Release Process

TODOs on Release

Run tests

Enforce rules e.g. app is not „debuggable“

Zip-align the APK

Sign APK with market key

Can be automated…

… using Maven

Releasing takes 2 minutes

repeatable!

3515.04.2011Copyright © 2011 – akquinet AG

Page 36: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Behind the scenes

Conclusion

3615.04.2011Copyright © 2011 – akquinet AG

Page 37: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Release Process

Developing apps for Android…

… is non-trivial.

Maintainability

Use Maven to build your app

Modularize your app

Correctness, Portability

Use androlog to get error reports from users

Write automated tests, e.g. with Marvin

Set up Hudson to build/test your app continuously

3715.04.2011Copyright © 2011 – akquinet AG

Page 38: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Prospects

Current work in progress

Easy injection of services and resources

Automatically compute quality metrics

Improve IDE support

http://blog.akquinet.de

3815.04.2011Copyright © 2011 – akquinet AG

Page 39: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android
Page 40: Rationalizing Android Development - BED-Con · 2016. 1. 15. · Android’s default set of tools What we have… Android SDK Compiler, Packager, Emulator, … Eclipse Plugin Android

Questions & Answers

?4015.04.2011Copyright © 2011 – akquinet AG