Tools and libraries for Common Android Problems

Post on 22-Jan-2018

128 views 3 download

Transcript of Tools and libraries for Common Android Problems

Android Libraries: Pros, Cons, & Gotchas

March 22, 2017Ryan Cooke

This is important.

Chet Haase “If that ecosystem is already enabled, what value are we adding by just adding something else to it?”

General tips - Reversibility

General Tips• Unit Test 3rd Party Libraries

• Method Count

• Methods Count

• Dex-method-counts

• Apk-method-count

• Pull out the core of the library

• Popular & Mature Libraries

• Beware of Unusual Approaches

Social LoginFacebook

• Test Users

• Email not guaranteed

• Key hashes

• Review is a pain

• Log errors

Social LoginTwitter • Not very popular <2% • https://support.twitter.com/forms/platform

LinkedIn • Not very popular <2% • Challenging api

Google • Multiple email choices • Design limitations

Login VariousSmart Lock • Great experience ideal case • Not on iOS • Assets.json requires server upload

Networking• Retrofit

• Volley

• OkHttp

• Behind the scenes

• Android 4.4

Networking Debugging - Stetho

Network Debugging - HttpLoggingInterceptor

ImagesPicasso

• Very small library (2.5.2/849)

• Simple to Use

Glide

• Gif support

• Various nice to haves

• Larger (3.7.0/2879)

ImagesTips

• Prefetch on lists

• Memory

• Profile

• Resize

Cloudinary

• largeHeap

• Bytes used = pixel width * pixel height * 4

ARGB_8888 RGB_565

ImagesFresco

• Magic memory cleverness

• Pre-lollipop (api 21)

• Progressive jpg

• Drawees instead of imageViews

Memory - LeaksLeak Canary • Difficult to read • Not easiest to share • Don’t forget to set watchers

WeakHandler

UIActivities Where it all began

Fragments Solution or Problem?

Views Swap content of frame layout

View-Based-ArchitectureMortar + Flow

• MVP

• Lacks solutions to common issues

View-Based-ArchitectureConductor

• Built solving common view based architecture issues

View-Based-ArchitectureScoop

• Limited Transition • Can’t Save State • Most Production Tested

Model View Presenter (MVP)• Mosby

• Tutorial

• ViewState

• Nucleus

• Mortar

• Build it yourself

Testing - Performance - NimbleDroid

Json• Gson

• Jackson

• Moshi

• LoganSquare—compile time work

• Flatbuffer—Json alternative

Database - SQLSQLite

SQLBrite • Reactive • Update with changes

Database - SQLSQLDelight • Work with SQL easier • Organizing sql statements • TypeSafe Api for read/write

ORMs • GreenDAO • OrmLite • DBFlow

Database - NoSQLRealm • Documentation and support • Super Fast

LevelDB • Key-Value pair by Google

Database - NoSQL

Database - Mobile Platform• Firebase

• Realm—offline first

Deeplinking• Services

• Yozio

• Branch

• Firebase Dynamic Links

• App link

• Deep Link Dispatch

Analytics• If you can measure you can optimize

• Wrapping 3rd party tools

• Log screens

• Don’t get lost

• Adding too many

• Untested

• Confusing naming

• Delaying easy decisions

• Finding too large of conclusions

Analytics - Firebase• Underlies all of firebase

• Free

• Actively Improving

Analytics• Google Analytics

• Basic

• Behavior Flow

• Play Store Console—Basic Core Questions

• Answers—Great for the office tv

• Mixpanel—Paid, but very good

• Lots more

A/B Testing• Disclaimer

• Overhyped

• Slow learning

• Great for making bugs

• Services

• Optimizely

• Firebase Remote Config

• Apptimize

• Analytic Service

• Store Listing

Crash Reporting• Play Store

• Misses most crashes

• Occasionally very useful

• Crashlytics—Free

• Bugsnag

• Paid

• Query crashes

• Instabug or Telescope—Easy to report bugs

Push Notifications• GCM/FCM—Not great for marketing people

• Analytic Services

• Firebase Notifications

• Mixpanel

• Push Services

• UrbanAirship

• Kahuna

• AI

Easier• Butterknife—Zelezny

• Hugo

• Dart & Henson

• Retrolambda

Harder (at First)• RxJava

• React to stuff

• Learning curve

• Misused

• Kotlin

• Cleaner code

• Null pointer

• New language

Logging• Logger—pretty logs

• Timber

• Custom logging behavior

• Combined logging options

Camera• Camera Intent • Material Camera—easy to fork • Android Crop

Camera• Camera Intent • Material Camera—easy to fork • Android Crop

Camera• Camera Intent • Material Camera—easy to fork • Android Crop

Thinking Globally• Network Emulation • Emulator • Charles Proxy • Augmented Traffic Control (ATC)

• AutoFitTextView • Year Class—2015 is the max • Connection Class—sampling is wonky

Android–Knit Have lunch with Pinterest Android

Questions

ryancooke@pinterest.com https://twitter.com/the__Ryanator

© Copyright, All Rights Reserved, Pinterest Inc. 2017