SlideShare a Scribd company logo
Developing Android apps
like Navy Seals
Ivan Kušt, Android team leader
Infinum Android team
How it all began?
How it all began
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
First steps
• Android plugin for Eclipse
• tests? who needs them
• Activities with > 1k lines
First steps
• no segregation of duties
• no code review
• poor code structure
Aint nobody got time for that
Regression testing?
So what did we do?
• Improved implementation process
• Included testing to development process
• Improved release process and analytics
Implementation
process
Working in a team
• git conflicts
• different code styles
• environment switching (test, production)
Working in a team
• bugfixing while developing a new feature
• weekly meetings and progress reports
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
branching / merging process
Pull Requests
debug staging release
obfuscated no yes yes
logs yes yes no
crash reporting no yes in most cases
Build types
Gradle
• Build types - debug, staging, release
• Product flavors - test API server, production API
server
Product flavors
• number of flavours = number of API environments
Build variants
• flavor x buildType
• example productionDebug
• production API
• debuggable, unobfuscated, logs enabled
Model Presenter View
Code architecture
MVP
• a derivative from MVC
• Models and Views never communicate directly
Model Presenter View
View
• Activity, Fragment, View
• propagates UI events to presenter
• exposes methods that control presentation of data
Model Presenter View
Presenter
• middle man between View and Model
• updates the UI - difference to MVC
Presenter ViewModel Presenter
• Activity, Fragment, View
• propagates UI events to presenter
• exposes methods that control presentation of data
View
View
Model
• gateway towards the business logic
• methods for data retrieval
Model Presenter
Example
showLoading()
hideLoading()
setUsernameError()
setPasswordError()
LoginPresenter
login(username, pass)
LoginView LoginModel
login(username, pass,
listener)
showLoading()
hideLoading()
setUsernameError()
setPasswordError()
LoginActivity
loginPresenter
login(username, pass)
LoginPresenterImpl
loginView
loginModel
LoginModelImpl
login(username, pass,
listener)
Testing
Instrument testing
• Robotium, Espresso
• runs on emulator or real device
Unit testing
• Robolectric
• write mock View and Interactor
• unit test Presenter
Dependency injection
• Dagger 2
• https://github.com/reisub/Dagger-2-Example
• simplifies writing tests
• Model / View / Presenter can easily be replaced
Without DI
@Override

protected void onCreate(Bundle savedInstanceState) {

//...



//dependencies

loginPresenter = new LoginPresenterImpl(this, new LoginModelImpl());



}
LoginView LoginPresenter LoginModel
LoginActivity LoginPresenterImpl LoginModelImpl
With DI
@Override

protected void onCreate(Bundle savedInstanceState) {

//...



//dependencies
DaggerLoginComponent.builder()
.loginModule(new LoginModule(this))
.build()
.inject(this);



}
With DI
• decoupling dependencies from implementation
• easier to replace dependencies
• more about Dagger:

http://google.github.io/dagger/
Robolectric
• mock Android VM (tests run on desktop machine)
• View doesn’t have to be mocked
• full control of Activity / Fragment lifecycle
• http://robolectric.org/
MockWebServer
• part of OkHttp library
• server that runs on localhost
• responses can be enqueued
• https://github.com/square/okhttp/tree/master/
mockwebserver
Mocking network layer
• network layer can be replaced with MockWebServer
• no additional mock classes
Continuous integration
• if not forced, you won’t run tests
Idea
• commit to a branch starts test execution
• CI server clones the repo, compiles and runs tests
• test results are archived and notified via mail / chat
CI servers
• Jenkins
• Travis
• Circle CI
• https://circleci.com/
• works only with GitHub
Static code checks
Findbugs
• http://findbugs.sourceforge.net/
• java.net.URL.hashCode()
Android Lint
• android related checks
• missing translations
• unused drawables
Checkstyle
Releasing
and analytics
Infinum Labs
Infinum Labs
• internal app store
• gradle task increments version name
• upload app via web, CLI tool or AS plugin
• library that notifies when new version is available
Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt
Analytics
Recap
• Improved implementation process
• Included testing to development process
• Improved release process and analytics
Implementation process
• organise teamwork - git flow
• monitor code quality - pull requests
• one click build - build variants
• code structuring - MVP
Testing
• Unit testing
• Continuous integration
• Static code checks
Releasing and analytics
• internal store for clients
• automatic notification when new version is up
• analytics / crashlytics
• initial project setup takes more time
• steeper learning and onboarding curve
• developing new features initially takes more time to
cover the code with unit test
Cons
• confidence in builds

(so much that we believe we’re Navy Seals)
• more maintainable code
• regression testing
Pros
Implementation Testing Release Post Release
Architecture
Build Types
MVP
Dependency
injection
Unit Tests
Robolectric
MockWebServer
Manual tests
Human tester
Infinum
Notifier lib
Analytics
Google analytics
Crashlytics
Play Store
Ivan Kušt
ivan@infinum.co
• if you have any questions:

More Related Content

PDF
Android talks #08 dagger2
PDF
Infinum Android Talks #12 - MVP design pattern for Android Apps
PPTX
Dagger 2
PDF
Clean architecture workshop
PPTX
Cypress workshop for JSFoo 2019
PDF
Introduction to Continuous Integration
PPTX
Effective .NET Core Unit Testing with SQLite and Dapper
PPTX
Building APIs with Node.js and Swagger
Android talks #08 dagger2
Infinum Android Talks #12 - MVP design pattern for Android Apps
Dagger 2
Clean architecture workshop
Cypress workshop for JSFoo 2019
Introduction to Continuous Integration
Effective .NET Core Unit Testing with SQLite and Dapper
Building APIs with Node.js and Swagger

What's hot (20)

PDF
Patterns and practices for building enterprise-scale HTML5 apps
PPTX
Introduction to cypress in Angular (Chinese)
PPTX
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
PPTX
ATAGTR2017 Performance Automation in Dev-Ops
PPTX
Continuous Delivery concept overview. Continuous Integration Systems. DevOps ...
PDF
A Separation of Concerns: Clean Architecture on Android
PPTX
ATAGTR2017 Expanding test horizons with Robot Framework
PPT
Intro to Service Worker API and its use cases
PPTX
Cucumber Tool
PPTX
What's new in Visual Studio 2013 & TFS 2013
PPTX
Hands on BDD with cucumber - Agile Goa Sept 2013
PDF
Designing APIs with OpenAPI Spec
PPTX
Automated Acceptance Tests & Tool choice
PPTX
Hidden Treasure - TestComplete Script Extensions
PDF
Documenting your REST API with Swagger - JOIN 2014
PPTX
Test Automation Framework with BDD and Cucumber
PPTX
Operations Validation for Infrastructure As Code - PSConfEU 2016
PPTX
Cypress test techniques cucumber bdd framework,tdd,api tests course
PPTX
Introduction to Bdd and cucumber
Patterns and practices for building enterprise-scale HTML5 apps
Introduction to cypress in Angular (Chinese)
Enhance existing REST APIs (e.g. Facebook Graph API) with code completion us...
ATAGTR2017 Performance Automation in Dev-Ops
Continuous Delivery concept overview. Continuous Integration Systems. DevOps ...
A Separation of Concerns: Clean Architecture on Android
ATAGTR2017 Expanding test horizons with Robot Framework
Intro to Service Worker API and its use cases
Cucumber Tool
What's new in Visual Studio 2013 & TFS 2013
Hands on BDD with cucumber - Agile Goa Sept 2013
Designing APIs with OpenAPI Spec
Automated Acceptance Tests & Tool choice
Hidden Treasure - TestComplete Script Extensions
Documenting your REST API with Swagger - JOIN 2014
Test Automation Framework with BDD and Cucumber
Operations Validation for Infrastructure As Code - PSConfEU 2016
Cypress test techniques cucumber bdd framework,tdd,api tests course
Introduction to Bdd and cucumber
Ad

Viewers also liked (20)

ODP
Asynctasks
PPTX
Performance #6 threading
PDF
Android Loaders : Reloaded
PPTX
Android Database Tutorial
PPTX
Sqlite Multiple Table
PPT
[Android] Google Play in app billing
PPTX
Android async task
PPTX
Android Dialogs Tutorial
PPT
Object Relational model for SQLIite in android
PPTX
BroadcastReceivers in Android
PDF
Android Http Connection and SAX Parsing
PPTX
Android Training (AdapterView & Adapter)
PPTX
Android material design lecture #2
PPTX
Android Training (Storing & Shared Preferences)
PPTX
Android AsyncTask Tutorial
PPTX
Android Training (Content Provider)
PPTX
Android Database
PPTX
Android Tutorials : Basic widgets
PPT
Android - Thread, Handler and AsyncTask
PDF
Android IPC Mechanism
Asynctasks
Performance #6 threading
Android Loaders : Reloaded
Android Database Tutorial
Sqlite Multiple Table
[Android] Google Play in app billing
Android async task
Android Dialogs Tutorial
Object Relational model for SQLIite in android
BroadcastReceivers in Android
Android Http Connection and SAX Parsing
Android Training (AdapterView & Adapter)
Android material design lecture #2
Android Training (Storing & Shared Preferences)
Android AsyncTask Tutorial
Android Training (Content Provider)
Android Database
Android Tutorials : Basic widgets
Android - Thread, Handler and AsyncTask
Android IPC Mechanism
Ad

Similar to Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt (20)

PDF
Innovation Generation - The Mobile Meetup: Android Best Practices
PDF
How to build rock solid apps & keep 100m+ users happy
PPTX
Lecture android best practices
PDF
Release & Iterate Faster: Stop Manual Testing
PDF
Oh so you test? - A guide to testing on Android from Unit to Mutation
PDF
Building Maintainable Android Apps (DroidCon NYC 2014)
PPTX
Android developer's toolbox
PDF
Android Building, Testing and reversing
PDF
Testing Android
PDF
Tools/Processes for serious android app development
PPTX
mobile development with androiddfdgdfhdgfdhf.pptx
PDF
Android testing
PDF
Testing and Building Android
PDF
World-Class Testing Development Pipeline for Android
PDF
How ANDROID TESTING changed how we think about Death - Second Edition
PDF
How ANDROID TESTING changed how we think about Death - Second Edition
PPTX
Introduction to Android- A session by Sagar Das
PDF
Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
PPTX
Android development
PDF
Cracking android app. Мокиенко Сергей
Innovation Generation - The Mobile Meetup: Android Best Practices
How to build rock solid apps & keep 100m+ users happy
Lecture android best practices
Release & Iterate Faster: Stop Manual Testing
Oh so you test? - A guide to testing on Android from Unit to Mutation
Building Maintainable Android Apps (DroidCon NYC 2014)
Android developer's toolbox
Android Building, Testing and reversing
Testing Android
Tools/Processes for serious android app development
mobile development with androiddfdgdfhdgfdhf.pptx
Android testing
Testing and Building Android
World-Class Testing Development Pipeline for Android
How ANDROID TESTING changed how we think about Death - Second Edition
How ANDROID TESTING changed how we think about Death - Second Edition
Introduction to Android- A session by Sagar Das
Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
Android development
Cracking android app. Мокиенко Сергей

More from Infinum (20)

PDF
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
PDF
Infinum Android Talks #20 - DiffUtil
PDF
Infinum Android Talks #20 - Benefits of using Kotlin
PDF
Infinum iOS Talks #4 - Making our VIPER more reactive
PDF
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
PDF
Infinum Android Talks #13 - Using ViewDragHelper
PDF
Infinum Android Talks #14 - Log4j
PDF
Infinum Android Talks #9 - Making your app location-aware
PDF
Infinum Android Talks #14 - Gradle plugins
PDF
Infinum Android Talks #14 - Facebook for Android API
PDF
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
PDF
Infinum Android Talks #18 - Create fun lists by Ivan Marić
PDF
Infinum Android Talks #18 - In-app billing by Ivan Marić
PDF
Infinum Android Talks #18 - How to cache like a boss by Željko Plesac
PDF
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
PDF
Infinum iOS Talks #2 - Xamarin by Ivan Đikić
PDF
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
PDF
Infinum iOS Talks #1 - Swift done right by Ivan Dikic
PDF
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
PDF
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust
Infinum Android Talks #20 - Making your Android apps fast like Blue Runner an...
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - Benefits of using Kotlin
Infinum iOS Talks #4 - Making our VIPER more reactive
Infinum iOS Talks #4 - Making your Swift networking code more awesome with Re...
Infinum Android Talks #13 - Using ViewDragHelper
Infinum Android Talks #14 - Log4j
Infinum Android Talks #9 - Making your app location-aware
Infinum Android Talks #14 - Gradle plugins
Infinum Android Talks #14 - Facebook for Android API
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #18 - Create fun lists by Ivan Marić
Infinum Android Talks #18 - In-app billing by Ivan Marić
Infinum Android Talks #18 - How to cache like a boss by Željko Plesac
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - Xamarin by Ivan Đikić
Infinum iOS Talks #1 - Swift under the hood: Method Dispatching by Vlaho Poluta
Infinum iOS Talks #1 - Swift done right by Ivan Dikic
Infinum iOS Talks #1 - Becoming an iOS developer swiftly by Vedran Burojevic
Infinum Android Talks #17 - Testing your Android applications by Ivan Kust

Recently uploaded (20)

PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
history of c programming in notes for students .pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
System and Network Administraation Chapter 3
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Cost to Outsource Software Development in 2025
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
Reimagine Home Health with the Power of Agentic AI​
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
history of c programming in notes for students .pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
System and Network Administraation Chapter 3
Digital Systems & Binary Numbers (comprehensive )
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Transform Your Business with a Software ERP System
wealthsignaloriginal-com-DS-text-... (1).pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Computer Software and OS of computer science of grade 11.pptx
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Odoo POS Development Services by CandidRoot Solutions
Cost to Outsource Software Development in 2025
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
How to Choose the Right IT Partner for Your Business in Malaysia

Infinum Android Talks #13 - Developing Android Apps Like Navy Seals by Ivan Kušt