SlideShare ist ein Scribd-Unternehmen logo
1 von 31
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

Weitere ähnliche Inhalte

Ähnlich wie 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 2012Michael Muller
 
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
 
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
 

Ähnlich wie 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
 

Mehr von Apteligent

Mobile App User Experience Myths, Debunked
Mobile App User Experience Myths, DebunkedMobile App User Experience Myths, Debunked
Mobile App User Experience Myths, DebunkedApteligent
 
Harnessing Data to Reduce User Churn
Harnessing Data to Reduce User ChurnHarnessing Data to Reduce User Churn
Harnessing Data to Reduce User ChurnApteligent
 
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 PerformanceApteligent
 
Apteligent Data Report Google IO Edition
Apteligent Data Report Google IO EditionApteligent Data Report Google IO Edition
Apteligent Data Report Google IO EditionApteligent
 
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 EditionApteligent
 
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 MetricsApteligent
 
50 Beautifully Designed Apple Watch Apps
50 Beautifully Designed Apple Watch Apps50 Beautifully Designed Apple Watch Apps
50 Beautifully Designed Apple Watch AppsApteligent
 
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 EditionApteligent
 
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 KnowApteligent
 
Apple Edition: iOS Mobile Experience Report
Apple Edition: iOS Mobile Experience ReportApple Edition: iOS Mobile Experience Report
Apple Edition: iOS Mobile Experience ReportApteligent
 
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 YouApteligent
 
Samsung Android Crash & Performance Analysis
Samsung Android Crash & Performance AnalysisSamsung Android Crash & Performance Analysis
Samsung Android Crash & Performance AnalysisApteligent
 
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 QualityApteligent
 
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
 

Mehr von 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!
 

Kürzlich hochgeladen

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Kürzlich hochgeladen (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

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

Hinweis der Redaktion

  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!