SlideShare a Scribd company logo
Developing Fault-Tolerant,
“German Engineered” Android Apps




Andrew Levy
andrew@crittercism.com
CEO, co-founder Crittercism
[droidcon ~]$ whoami
• Andrew Levy
  – Co-founder & CEO @Crittercism

• Crittercism
  – Real-time crash reports and error analysis for mobile
    developers
  – Analyzed well over a billion application loads in the
    past few months
  – Backed by Google Ventures, Kleiner-Perkins, and
    others

                    www.crittercism.com - @crittercism
What’s Ahead
 1.   Testing Difficulties
 2.   Top 5 Android Crashes
 3.   iOS vs Android, which crashes less???
 4.   Quick peak at Crittercism’s Error Analysis
 5.   Questions
 6.   Free Stickers




                   www.crittercism.com - @crittercism
Android Device Diversity
Example app shortly after launch: has 30k DAU, 175k unique users, 50 different devices




                               www.crittercism.com - @crittercism
iOS Fragmentation




This app has over 850,000
users, 26 diff app versions, 12
different devices




                                  www.crittercism.com - @crittercism
iOS 5.0.1   iOS 5.1
How Many iOS Versions Released?                                                                                                                         November 10 March 7
                                                                                                                                                        2011        2012

                                                                                                                                                    4.2.5
                                                                                                                                                    February 7, 2011

                                                                                                                                                    4.2.6
                                                                                                                                                    February 10, 2011

                                                                                                                                                        4.3
                                                                                                                                                        March 9, 2011

                                                                                                                                                         4.3.1
                                                                                                                                                         March 25, 2011

                                                                                                                                                           4.2.7
                                                                                                                                                           April 14, 2011

                                                                                                                                                           4.3.2
                                                                                                                                                           April 14, 2011

1.0                                       2.0                                                                                 3.2.1                          4.2.8
June 29, 2007                             J 11, 2008
                                           uly                                                                                J 15, 2010
                                                                                                                               uly                           May 4, 2011

        1.1                               1.1.5                                                                               4.0.1                                     4.2.9
        September 14, 2007                J 15, 2008
                                           uly                                                                                J 15, 2010
                                                                                                                               uly                                      J 15, 2011
                                                                                                                                                                         uly

          1.1.1                                 2.0.2                             3.0                                            3.2.2                                  4.3.4
          September 27, 2007                    August 18, 2008                   June 17, 2009                                  August 11, 2010                        J 15, 2011
                                                                                                                                                                         uly

                1.1.2                              2.1                                3.0.1                3.1.3                 4.0.2                                  4.2.10
                November 12, 2007                  September 9, 2008                  J 31, 2009
                                                                                       uly                 February 2, 2010      August 11, 2010                        J 25, 2011
                                                                                                                                                                         uly

     1.0.2                 1.1.4                           2.2                             3.1                            4.0               4.2.1                       4.3.5
     August 21, 2007       February 26, 2008               November 21, 2008               September 9, 2009              June 21, 2010     November 22, 2010           J 25, 2011
                                                                                                                                                                         uly

   1.0.1               1.1.3                   2.0.1               2.2.1                      3.1.2              3.2                4.1                      4.3.3              5.0
   J 31, 2007
    uly                January 15, 2008        August 4, 2008      January 27, 2009           October 8, 2009    April 3, 2010      September 8, 2010        May 4, 2011        October 12, 2011



                                                                                                                                                                                             iOS Versions
                  2008                                      2009                                    2010                                     2011                                    2012




                                                                       www.crittercism.com - @crittercism
Android Testing
Build & Test

• Integrated Testing Tools in your IDE
    • OEMs (developer.samsung.com, developer.motorola.com, etc)
    • 3rd Party Solutions
        • Robotium, MonkeyRunner, Robolectric, etc

• Remote Device Testing
   • Also offered by OEMs
   • Device Anywhere, uTest, Mob4Hire, Perfecto Mobile, etc.

• Crashes still make it out into the wild
   • QA Matrix/Permutations



                            www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
java.lang.NullPointerException
• “works for me” is not a good test, there are a
  thousand Android devices
  – Assume the worst, common places of NPE:
     • #1 location in code for NPEs seems to be onResume()
        – Probably due to devs assuming class members accessible after
          onPause()
     • Data from intents
     • Peripheral/Sensor data (Camera, GPS, etc)
        – Some of these errors can be device/manufacturer specific
     • Broadcast receivers

                      www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
java.lang.OutOfMemoryError
Memory Leak in Dalvik: Keeping a reference to an object longer than needed



  Not the best idea:
  try
  {
        // allocate lots of objects
  }
  catch(OutOfMemoryError oom)
  {
       // recycle some objects
  }




                          www.crittercism.com - @crittercism
java.lang.OutOfMemoryError
 Memory Leak in Dalvik: Keeping a reference to an object longer than needed



Biggest Culprit: Bitmaps
– memory usage
    • width px * height px * 4 bytes (for ARGB images)
– SoftReferences, recycle
– Pre Honeycomb (<3.0) native heap, now in the normal
  heap
    • Use hprof -- if using Eclipse, Memory Analyzer (MAT)

ListViews
- Use convertView & viewHolder Pattern
                        www.crittercism.com - @crittercism
java.lang.OutOfMemoryError
• What about the NDK?
  – In the past some devs built their C++ code on
    other platforms, then used tools on that platform
    to analyze
  – New as of November 5, 2011:
     • Valgrind 3.7.0 adds preliminary ARM Android support
       (2.3.x)
        – May need rooted AOSP build, need libc with debug symbols




                     www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
android.view.WindowManager$BadTok
             enException
 Biggest Culprit: Dialogs

 • Common error for beginners, creating a dialog via
   getApplicationContext()
    – Android docs are wrong, need to create dialog in context of an Activity




                           www.crittercism.com - @crittercism
android.view.WindowManager$BadTok
             enException
 Biggest Culprit: Dialogs

 • Anything that changes the context of the activity will cause issues

     – Showing a dialog after activity’s onPause is called (phone call, Back, Home, etc)

     – Examples
          • Screen Rotation during a ProgressBar
               – The most common (and not recommended) fix:
                    » Add android:configChanges="orientation” to manifest, just
                       onConfigurationChanged is called
               – Recommended:
                    » save your instance state, re-set any activity context references to the new
                       one
          • Launch dialog with an old/null context

     – Be sure to use DialogFragment, old dialogs are deprecated

                                 www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
java.lang.IllegalArgumentException
             (extends java.lang.RuntimeException)


• Common Examples:

   – ContentProvider does not exist
      • i.e. try the Network Location Provider in the emulator
      • Don’t use undocumented Content Providers

   – Using unknown or invalid View IDs
      • Confusing a string identifier and integer value wrt setValue()

   – Activity is finished already, but you call dismiss on a dialog


                           www.crittercism.com - @crittercism
java.lang.RuntimeException
• Common Pitfalls

   – Forgetting to add an Activity to the Manifest

   – Failing to close a camera service before using it again
       • Some phones have a race condition with releasing the camera, be sure
         to make these calls in surfaceDestroyed
           1.   cameraObject.setPreviewCallback(null); // prevent race condition
           2.   cameraObject.stopPreview();
           3.   cameraObject.release();

   – Loading UI elements directly from a background thread

   – Trying to use a recycled bitmap

                            www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
Top 5 Android Crashes
               +85% of crashes
1. java.lang.NullPointerException

1. java.lang.OutOfMemoryError

2. android.view.WindowManager$BadTokenException

3. java.lang.IllegalArgumentException &
   java.lang.RuntimeException

4. android.database.sqlite.SQLiteException
                     www.crittercism.com - @crittercism
android.database.sqlite.SQLiteException
• Use the database helper, accessing DB file directly
  prone to errors
   – Read/write permissions, SD card issues, etc.

• Use only one SQLite connection
   – Even if you use threads, share one connection

• Prepared Queries with unknown columns is a common
  mistake

• SQL Syntax Errors

                      www.crittercism.com - @crittercism
Crashes on iOS & Android




       www.crittercism.com - @crittercism
Crashes on iOS & Android




                                            Hard to read pie chart
       www.crittercism.com - @crittercism
www.crittercism.com - @crittercism
www.crittercism.com - @crittercism
Questions?




Andrew Levy
andrew@crittercism.com
@crittercism and @andrewmlevy

More Related Content

Similar to Crittercism Droidcon Berlin 2012

Can Metadata Keep Libraries Relevant?
Can Metadata Keep Libraries Relevant?Can Metadata Keep Libraries Relevant?
Can Metadata Keep Libraries Relevant?
Richard Wallis
 
Muller and Chua - brainstorming for japan - chi 2012
Muller and Chua - brainstorming for japan - chi 2012Muller and Chua - brainstorming for japan - chi 2012
Muller and Chua - brainstorming for japan - chi 2012
Michael Muller
 
Einstein finalist.nl
Einstein finalist.nlEinstein finalist.nl
Einstein finalist.nl
Vincent Everts
 
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011Finalist - open IT oplossingen
 
Career plan template
Career plan templateCareer plan template
Career plan template
Vaikunthan Rajaratnam
 
Koss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser appsKoss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser appsEvil Martians
 
SeaJS - 跨环境模块化开发实践
SeaJS - 跨环境模块化开发实践SeaJS - 跨环境模块化开发实践
SeaJS - 跨环境模块化开发实践lifesinger
 
Capstone project timeline
Capstone project timelineCapstone project timeline
Capstone project timelineTeam MBA
 

Similar to Crittercism Droidcon Berlin 2012 (10)

Can Metadata Keep Libraries Relevant?
Can Metadata Keep Libraries Relevant?Can Metadata Keep Libraries Relevant?
Can Metadata Keep Libraries Relevant?
 
Career plan template
Career plan templateCareer plan template
Career plan template
 
Muller and Chua - brainstorming for japan - chi 2012
Muller and Chua - brainstorming for japan - chi 2012Muller and Chua - brainstorming for japan - chi 2012
Muller and Chua - brainstorming for japan - chi 2012
 
Einstein finalist.nl
Einstein finalist.nlEinstein finalist.nl
Einstein finalist.nl
 
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
Inspiratiemiddag_Vincent_Everts_Finalist generatie_einstein_komt_eraan_07042011
 
Gantt chart for work
Gantt chart for workGantt chart for work
Gantt chart for work
 
Career plan template
Career plan templateCareer plan template
Career plan template
 
Koss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser appsKoss, How to make desktop caliber browser apps
Koss, How to make desktop caliber browser apps
 
SeaJS - 跨环境模块化开发实践
SeaJS - 跨环境模块化开发实践SeaJS - 跨环境模块化开发实践
SeaJS - 跨环境模块化开发实践
 
Capstone project timeline
Capstone project timelineCapstone project timeline
Capstone project timeline
 

More from Apteligent

Mobile App User Experience Myths, Debunked
Mobile App User Experience Myths, DebunkedMobile App User Experience Myths, Debunked
Mobile App User Experience Myths, Debunked
Apteligent
 
Harnessing Data to Reduce User Churn
Harnessing Data to Reduce User ChurnHarnessing Data to Reduce User Churn
Harnessing Data to Reduce User Churn
Apteligent
 
Apteligent - Choosing the Right SDKs to Optimize App Performance
Apteligent - Choosing the Right SDKs to Optimize App PerformanceApteligent - Choosing the Right SDKs to Optimize App Performance
Apteligent - Choosing the Right SDKs to Optimize App Performance
Apteligent
 
Apteligent Data Report Google IO Edition
Apteligent Data Report Google IO EditionApteligent Data Report Google IO Edition
Apteligent Data Report Google IO Edition
Apteligent
 
Apteligent Data Report iOS 9.3 Edition
Apteligent Data Report iOS 9.3 EditionApteligent Data Report iOS 9.3 Edition
Apteligent Data Report iOS 9.3 Edition
Apteligent
 
7 Tips for Optimizing Mobile App Metrics
7 Tips for Optimizing Mobile App Metrics7 Tips for Optimizing Mobile App Metrics
7 Tips for Optimizing Mobile App Metrics
Apteligent
 
50 Beautifully Designed Apple Watch Apps
50 Beautifully Designed Apple Watch Apps50 Beautifully Designed Apple Watch Apps
50 Beautifully Designed Apple Watch Apps
Apteligent
 
State of Mobile Benchmark Report - MWC 2015 Edition
State of Mobile Benchmark Report -  MWC 2015 EditionState of Mobile Benchmark Report -  MWC 2015 Edition
State of Mobile Benchmark Report - MWC 2015 Edition
Apteligent
 
Accenture Digital: iOS 8 What You Need to Know
Accenture Digital: iOS 8 What You Need to KnowAccenture Digital: iOS 8 What You Need to Know
Accenture Digital: iOS 8 What You Need to Know
Apteligent
 
Apple Edition: iOS Mobile Experience Report
Apple Edition: iOS Mobile Experience ReportApple Edition: iOS Mobile Experience Report
Apple Edition: iOS Mobile Experience Report
Apteligent
 
50 Connected Devices - How Mobile and the Internet of Things Will Affect You
50 Connected Devices - How Mobile and the Internet of Things Will Affect You50 Connected Devices - How Mobile and the Internet of Things Will Affect You
50 Connected Devices - How Mobile and the Internet of Things Will Affect You
Apteligent
 
Mobile DevOps
Mobile DevOpsMobile DevOps
Mobile DevOps
Apteligent
 
Samsung Android Crash & Performance Analysis
Samsung Android Crash & Performance AnalysisSamsung Android Crash & Performance Analysis
Samsung Android Crash & Performance Analysis
Apteligent
 
testCloud & Crittercism: How to Continuously Ensure Mobile App Quality
testCloud & Crittercism: How to Continuously Ensure Mobile App QualitytestCloud & Crittercism: How to Continuously Ensure Mobile App Quality
testCloud & Crittercism: How to Continuously Ensure Mobile App Quality
Apteligent
 
WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...
WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...
WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...Apteligent
 
Getting to Mobile First: 5 Numbers to Consider!
Getting to Mobile First: 5 Numbers to Consider!Getting to Mobile First: 5 Numbers to Consider!
Getting to Mobile First: 5 Numbers to Consider!Apteligent
 

More from Apteligent (16)

Mobile App User Experience Myths, Debunked
Mobile App User Experience Myths, DebunkedMobile App User Experience Myths, Debunked
Mobile App User Experience Myths, Debunked
 
Harnessing Data to Reduce User Churn
Harnessing Data to Reduce User ChurnHarnessing Data to Reduce User Churn
Harnessing Data to Reduce User Churn
 
Apteligent - Choosing the Right SDKs to Optimize App Performance
Apteligent - Choosing the Right SDKs to Optimize App PerformanceApteligent - Choosing the Right SDKs to Optimize App Performance
Apteligent - Choosing the Right SDKs to Optimize App Performance
 
Apteligent Data Report Google IO Edition
Apteligent Data Report Google IO EditionApteligent Data Report Google IO Edition
Apteligent Data Report Google IO Edition
 
Apteligent Data Report iOS 9.3 Edition
Apteligent Data Report iOS 9.3 EditionApteligent Data Report iOS 9.3 Edition
Apteligent Data Report iOS 9.3 Edition
 
7 Tips for Optimizing Mobile App Metrics
7 Tips for Optimizing Mobile App Metrics7 Tips for Optimizing Mobile App Metrics
7 Tips for Optimizing Mobile App Metrics
 
50 Beautifully Designed Apple Watch Apps
50 Beautifully Designed Apple Watch Apps50 Beautifully Designed Apple Watch Apps
50 Beautifully Designed Apple Watch Apps
 
State of Mobile Benchmark Report - MWC 2015 Edition
State of Mobile Benchmark Report -  MWC 2015 EditionState of Mobile Benchmark Report -  MWC 2015 Edition
State of Mobile Benchmark Report - MWC 2015 Edition
 
Accenture Digital: iOS 8 What You Need to Know
Accenture Digital: iOS 8 What You Need to KnowAccenture Digital: iOS 8 What You Need to Know
Accenture Digital: iOS 8 What You Need to Know
 
Apple Edition: iOS Mobile Experience Report
Apple Edition: iOS Mobile Experience ReportApple Edition: iOS Mobile Experience Report
Apple Edition: iOS Mobile Experience Report
 
50 Connected Devices - How Mobile and the Internet of Things Will Affect You
50 Connected Devices - How Mobile and the Internet of Things Will Affect You50 Connected Devices - How Mobile and the Internet of Things Will Affect You
50 Connected Devices - How Mobile and the Internet of Things Will Affect You
 
Mobile DevOps
Mobile DevOpsMobile DevOps
Mobile DevOps
 
Samsung Android Crash & Performance Analysis
Samsung Android Crash & Performance AnalysisSamsung Android Crash & Performance Analysis
Samsung Android Crash & Performance Analysis
 
testCloud & Crittercism: How to Continuously Ensure Mobile App Quality
testCloud & Crittercism: How to Continuously Ensure Mobile App QualitytestCloud & Crittercism: How to Continuously Ensure Mobile App Quality
testCloud & Crittercism: How to Continuously Ensure Mobile App Quality
 
WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...
WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...
WEBINAR: HOW URBAN OUTFITTERS MADE A 7X IMPROVEMENT IN THEIR MOBILE APP PERFO...
 
Getting to Mobile First: 5 Numbers to Consider!
Getting to Mobile First: 5 Numbers to Consider!Getting to Mobile First: 5 Numbers to Consider!
Getting to Mobile First: 5 Numbers to Consider!
 

Recently uploaded

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 

Recently uploaded (20)

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 

Crittercism Droidcon Berlin 2012

  • 1. Developing Fault-Tolerant, “German Engineered” Android Apps Andrew Levy andrew@crittercism.com CEO, co-founder Crittercism
  • 2. [droidcon ~]$ whoami • Andrew Levy – Co-founder & CEO @Crittercism • Crittercism – Real-time crash reports and error analysis for mobile developers – Analyzed well over a billion application loads in the past few months – Backed by Google Ventures, Kleiner-Perkins, and others www.crittercism.com - @crittercism
  • 3. What’s Ahead 1. Testing Difficulties 2. Top 5 Android Crashes 3. iOS vs Android, which crashes less??? 4. Quick peak at Crittercism’s Error Analysis 5. Questions 6. Free Stickers www.crittercism.com - @crittercism
  • 4. Android Device Diversity Example app shortly after launch: has 30k DAU, 175k unique users, 50 different devices www.crittercism.com - @crittercism
  • 5. iOS Fragmentation This app has over 850,000 users, 26 diff app versions, 12 different devices www.crittercism.com - @crittercism
  • 6. iOS 5.0.1 iOS 5.1 How Many iOS Versions Released? November 10 March 7 2011 2012 4.2.5 February 7, 2011 4.2.6 February 10, 2011 4.3 March 9, 2011 4.3.1 March 25, 2011 4.2.7 April 14, 2011 4.3.2 April 14, 2011 1.0 2.0 3.2.1 4.2.8 June 29, 2007 J 11, 2008 uly J 15, 2010 uly May 4, 2011 1.1 1.1.5 4.0.1 4.2.9 September 14, 2007 J 15, 2008 uly J 15, 2010 uly J 15, 2011 uly 1.1.1 2.0.2 3.0 3.2.2 4.3.4 September 27, 2007 August 18, 2008 June 17, 2009 August 11, 2010 J 15, 2011 uly 1.1.2 2.1 3.0.1 3.1.3 4.0.2 4.2.10 November 12, 2007 September 9, 2008 J 31, 2009 uly February 2, 2010 August 11, 2010 J 25, 2011 uly 1.0.2 1.1.4 2.2 3.1 4.0 4.2.1 4.3.5 August 21, 2007 February 26, 2008 November 21, 2008 September 9, 2009 June 21, 2010 November 22, 2010 J 25, 2011 uly 1.0.1 1.1.3 2.0.1 2.2.1 3.1.2 3.2 4.1 4.3.3 5.0 J 31, 2007 uly January 15, 2008 August 4, 2008 January 27, 2009 October 8, 2009 April 3, 2010 September 8, 2010 May 4, 2011 October 12, 2011 iOS Versions 2008 2009 2010 2011 2012 www.crittercism.com - @crittercism
  • 7. Android Testing Build & Test • Integrated Testing Tools in your IDE • OEMs (developer.samsung.com, developer.motorola.com, etc) • 3rd Party Solutions • Robotium, MonkeyRunner, Robolectric, etc • Remote Device Testing • Also offered by OEMs • Device Anywhere, uTest, Mob4Hire, Perfecto Mobile, etc. • Crashes still make it out into the wild • QA Matrix/Permutations www.crittercism.com - @crittercism
  • 8. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 9. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 10. java.lang.NullPointerException • “works for me” is not a good test, there are a thousand Android devices – Assume the worst, common places of NPE: • #1 location in code for NPEs seems to be onResume() – Probably due to devs assuming class members accessible after onPause() • Data from intents • Peripheral/Sensor data (Camera, GPS, etc) – Some of these errors can be device/manufacturer specific • Broadcast receivers www.crittercism.com - @crittercism
  • 11. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 12. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 13. java.lang.OutOfMemoryError Memory Leak in Dalvik: Keeping a reference to an object longer than needed Not the best idea: try { // allocate lots of objects } catch(OutOfMemoryError oom) { // recycle some objects } www.crittercism.com - @crittercism
  • 14. java.lang.OutOfMemoryError Memory Leak in Dalvik: Keeping a reference to an object longer than needed Biggest Culprit: Bitmaps – memory usage • width px * height px * 4 bytes (for ARGB images) – SoftReferences, recycle – Pre Honeycomb (<3.0) native heap, now in the normal heap • Use hprof -- if using Eclipse, Memory Analyzer (MAT) ListViews - Use convertView & viewHolder Pattern www.crittercism.com - @crittercism
  • 15. java.lang.OutOfMemoryError • What about the NDK? – In the past some devs built their C++ code on other platforms, then used tools on that platform to analyze – New as of November 5, 2011: • Valgrind 3.7.0 adds preliminary ARM Android support (2.3.x) – May need rooted AOSP build, need libc with debug symbols www.crittercism.com - @crittercism
  • 16. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 17. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 18. android.view.WindowManager$BadTok enException Biggest Culprit: Dialogs • Common error for beginners, creating a dialog via getApplicationContext() – Android docs are wrong, need to create dialog in context of an Activity www.crittercism.com - @crittercism
  • 19. android.view.WindowManager$BadTok enException Biggest Culprit: Dialogs • Anything that changes the context of the activity will cause issues – Showing a dialog after activity’s onPause is called (phone call, Back, Home, etc) – Examples • Screen Rotation during a ProgressBar – The most common (and not recommended) fix: » Add android:configChanges="orientation” to manifest, just onConfigurationChanged is called – Recommended: » save your instance state, re-set any activity context references to the new one • Launch dialog with an old/null context – Be sure to use DialogFragment, old dialogs are deprecated www.crittercism.com - @crittercism
  • 20. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 21. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 22. java.lang.IllegalArgumentException (extends java.lang.RuntimeException) • Common Examples: – ContentProvider does not exist • i.e. try the Network Location Provider in the emulator • Don’t use undocumented Content Providers – Using unknown or invalid View IDs • Confusing a string identifier and integer value wrt setValue() – Activity is finished already, but you call dismiss on a dialog www.crittercism.com - @crittercism
  • 23. java.lang.RuntimeException • Common Pitfalls – Forgetting to add an Activity to the Manifest – Failing to close a camera service before using it again • Some phones have a race condition with releasing the camera, be sure to make these calls in surfaceDestroyed 1. cameraObject.setPreviewCallback(null); // prevent race condition 2. cameraObject.stopPreview(); 3. cameraObject.release(); – Loading UI elements directly from a background thread – Trying to use a recycled bitmap www.crittercism.com - @crittercism
  • 24. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 25. Top 5 Android Crashes +85% of crashes 1. java.lang.NullPointerException 1. java.lang.OutOfMemoryError 2. android.view.WindowManager$BadTokenException 3. java.lang.IllegalArgumentException & java.lang.RuntimeException 4. android.database.sqlite.SQLiteException www.crittercism.com - @crittercism
  • 26. android.database.sqlite.SQLiteException • Use the database helper, accessing DB file directly prone to errors – Read/write permissions, SD card issues, etc. • Use only one SQLite connection – Even if you use threads, share one connection • Prepared Queries with unknown columns is a common mistake • SQL Syntax Errors www.crittercism.com - @crittercism
  • 27. Crashes on iOS & Android www.crittercism.com - @crittercism
  • 28. Crashes on iOS & Android Hard to read pie chart www.crittercism.com - @crittercism

Editor's Notes

  1. Identify errors, be very proactive,
  2. this app is now available on hundreds of devices
  3. And it’s not just a problem on Android. Let’s think about iOS. How many version of iOS do you think have been released in the past 4 years? There’s been a total of 41 operating systems released so far – about 1 version a month. iOS version 5.0 which comes out tomorrow will be the 13th new operating system this year. 17 versions for AndroidiOS 5.0.2 delayed because of memory leaks
  4. A lot of these solutions are just functional tests, but simply cant scale to the number of permutations of device configurations and application use, give a shoutout to bitbar
  5. Save your state properly! Use instance state, persistent storage, or some of the built in
  6. Libc debug logcat
  7. Reported as a bug 1.5 years ago, still not fixed
  8. Pre honeycomb, will need compatibility library
  9. Boring one, Not one clear leader here for the cause of issue, lets say you want to display an integer in a label, if you forget to cast it to a string it’ll look for an ID of string resource instead
  10. These are easy to run into. The common theme here is clear your resources when you’re done, close your file descriptors, not only will it contribute to memory issues but you may end up running into a RuntimeException anyway. Of course, be careful once you clear a resource, and then try to use the cleared resource again!