46

Tools and libraries for Common Android Problems

  • Upload
    rc2209

  • View
    127

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Tools and libraries for Common Android Problems
Page 2: Tools and libraries for Common Android Problems

Android Libraries: Pros, Cons, & Gotchas

March 22, 2017Ryan Cooke

Page 3: Tools and libraries for Common Android Problems

This is important.

Page 4: Tools and libraries for Common Android Problems

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

Page 5: Tools and libraries for Common Android Problems

General tips - Reversibility

Page 6: Tools and libraries for Common Android Problems

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

Page 7: Tools and libraries for Common Android Problems

Social LoginFacebook

• Test Users

• Email not guaranteed

• Key hashes

• Review is a pain

• Log errors

Page 8: Tools and libraries for Common Android Problems

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

Page 9: Tools and libraries for Common Android Problems

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

Page 10: Tools and libraries for Common Android Problems

Networking• Retrofit

• Volley

• OkHttp

• Behind the scenes

• Android 4.4

Page 11: Tools and libraries for Common Android Problems

Networking Debugging - Stetho

Page 12: Tools and libraries for Common Android Problems

Network Debugging - HttpLoggingInterceptor

Page 13: Tools and libraries for Common Android Problems

ImagesPicasso

• Very small library (2.5.2/849)

• Simple to Use

Glide

• Gif support

• Various nice to haves

• Larger (3.7.0/2879)

Page 14: Tools and libraries for Common Android Problems

ImagesTips

• Prefetch on lists

• Memory

• Profile

• Resize

Cloudinary

• largeHeap

• Bytes used = pixel width * pixel height * 4

Page 15: Tools and libraries for Common Android Problems

ARGB_8888 RGB_565

Page 16: Tools and libraries for Common Android Problems

ImagesFresco

• Magic memory cleverness

• Pre-lollipop (api 21)

• Progressive jpg

• Drawees instead of imageViews

Page 17: Tools and libraries for Common Android Problems

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

WeakHandler

Page 18: Tools and libraries for Common Android Problems

UIActivities Where it all began

Fragments Solution or Problem?

Views Swap content of frame layout

Page 19: Tools and libraries for Common Android Problems

View-Based-ArchitectureMortar + Flow

• MVP

• Lacks solutions to common issues

Page 20: Tools and libraries for Common Android Problems

View-Based-ArchitectureConductor

• Built solving common view based architecture issues

Page 21: Tools and libraries for Common Android Problems

View-Based-ArchitectureScoop

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

Page 22: Tools and libraries for Common Android Problems

Model View Presenter (MVP)• Mosby

• Tutorial

• ViewState

• Nucleus

• Mortar

• Build it yourself

Page 23: Tools and libraries for Common Android Problems

Testing - Performance - NimbleDroid

Page 24: Tools and libraries for Common Android Problems

Json• Gson

• Jackson

• Moshi

• LoganSquare—compile time work

• Flatbuffer—Json alternative

Page 25: Tools and libraries for Common Android Problems

Database - SQLSQLite

SQLBrite • Reactive • Update with changes

Page 26: Tools and libraries for Common Android Problems

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

ORMs • GreenDAO • OrmLite • DBFlow

Page 27: Tools and libraries for Common Android Problems

Database - NoSQLRealm • Documentation and support • Super Fast

LevelDB • Key-Value pair by Google

Page 28: Tools and libraries for Common Android Problems

Database - NoSQL

Page 29: Tools and libraries for Common Android Problems

Database - Mobile Platform• Firebase

• Realm—offline first

Page 30: Tools and libraries for Common Android Problems

Deeplinking• Services

• Yozio

• Branch

• Firebase Dynamic Links

• App link

• Deep Link Dispatch

Page 31: Tools and libraries for Common Android Problems

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

Page 32: Tools and libraries for Common Android Problems

Analytics - Firebase• Underlies all of firebase

• Free

• Actively Improving

Page 33: Tools and libraries for Common Android Problems

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

Page 34: Tools and libraries for Common Android Problems

A/B Testing• Disclaimer

• Overhyped

• Slow learning

• Great for making bugs

• Services

• Optimizely

• Firebase Remote Config

• Apptimize

• Analytic Service

• Store Listing

Page 35: Tools and libraries for Common Android Problems

Crash Reporting• Play Store

• Misses most crashes

• Occasionally very useful

• Crashlytics—Free

• Bugsnag

• Paid

• Query crashes

• Instabug or Telescope—Easy to report bugs

Page 36: Tools and libraries for Common Android Problems

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

• Analytic Services

• Firebase Notifications

• Mixpanel

• Push Services

• UrbanAirship

• Kahuna

• AI

Page 37: Tools and libraries for Common Android Problems

Easier• Butterknife—Zelezny

• Hugo

• Dart & Henson

• Retrolambda

Page 38: Tools and libraries for Common Android Problems

Harder (at First)• RxJava

• React to stuff

• Learning curve

• Misused

• Kotlin

• Cleaner code

• Null pointer

• New language

Page 39: Tools and libraries for Common Android Problems

Logging• Logger—pretty logs

• Timber

• Custom logging behavior

• Combined logging options

Page 40: Tools and libraries for Common Android Problems

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

Page 41: Tools and libraries for Common Android Problems

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

Page 42: Tools and libraries for Common Android Problems

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

Page 43: Tools and libraries for Common Android Problems

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

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

Page 44: Tools and libraries for Common Android Problems

Android–Knit Have lunch with Pinterest Android

Page 45: Tools and libraries for Common Android Problems

Questions

[email protected] https://twitter.com/the__Ryanator

Page 46: Tools and libraries for Common Android Problems

© Copyright, All Rights Reserved, Pinterest Inc. 2017