Slide 1

Slide 1 text

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pinapps.android/com.pinapps.android.ActAppDetails}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125) at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3553) at android.app.ActivityThread.access$700(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4898) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 1008) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.pinapps.android.FragAppMedia.onCreateView(FragAppMedia.java:126) at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460) ... 12 more java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pinapps.android/com.pinapps.android.ActSplash}: android.view.InflateException: Binary XML file line #2: Error inflating class at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1670) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1686) at android.app.ActivityThread.access$1500(ActivityThread.java:118) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:932) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3706) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 841) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class at android.view.LayoutInflater.createView(LayoutInflater.java:518) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInfl ater.java:56) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568) java.lang.RuntimeException: Unable to resume activity {com.pinapps.android/ com.facebook.LoginActivity}: com.facebook.FacebookException: Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance. at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2138) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2153) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1682) at android.app.ActivityThread.access$1500(ActivityThread.java:117) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:130) at android.app.ActivityThread.main(ActivityThread.java:3701) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) at dalvik.system.NativeStart.main(Native Method) Caused by: com.facebook.FacebookException: Cannot call LoginActivity with a null calling package. This can occur if the launchMode of the caller is singleInstance. at com.facebook.LoginActivity.onResume(LoginActivity.java:110) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1176) at android.app.Activity.performResume(Activity.java:3882) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2128) ... 12 more java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pinapps.android/ com.pinapps.android.ActAppDetails}: java.lang.IllegalStateException: ViewPager does not have adapter instance. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) at android.app.ActivityThread.access$600(ActivityThread.java:130) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IllegalStateException: ViewPager does not have adapter instance. at com.viewpagerindicator.TitlePageIndicator.setViewPager(TitlePageIndicator.java:716) at com.pinapps.android.ActAppDetails.onCreate(ActAppDetails.java:129) at android.app.Activity.performCreate(Activity.java:5008) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) ... 11 more What BigData tell us about Android Errors What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab 1 Tuesday, April 9, 13

Slide 2

Slide 2 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab I’m Panos Papadopoulos Founder & CEO at BugSense @panosjee I’m Maria Kechagia PhD student at AUEB Researcher at ISTLab ISTLab ISTLab 2 Tuesday, April 9, 13

Slide 3

Slide 3 text

You are here because of ANDROID BUGS Tuesday, April 9, 13

Slide 4

Slide 4 text

ISTLab BigData Research 3M stack traces From Mar 1 to May 30 2012 320M devices 40M crashes What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab ISTLab 4 Tuesday, April 9, 13

Slide 5

Slide 5 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Affected Users Lost Users Total Users Crashing apps lead to user churn ISTLab ISTLab 5 Tuesday, April 9, 13

Slide 6

Slide 6 text

ISTLab 6 The Process Java Stack Traces Android Apps Data Signatures API Design Problems Heuristics Crash Causes Categorization Data Cleaning Suggestions What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab ISTLab 6 Tuesday, April 9, 13

Slide 7

Slide 7 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Heuristic Function ISTLab ISTLab (﴾F+ (﴾A+ I∗)﴿∗)﴿ | (﴾F∗ (﴾A+ I∗)﴿+)﴿E This expresses various scenarios in which an exception can occur Within the Android framework: F + E Within the application: F ∗ A+ E When the application calls an api: F∗ A+ I+ E Within an api-‐registered application callback: F∗ (﴾A+ I+ A+)﴿+ E When an api-‐registered application callback calls an api: F∗ (﴾A+ I+)﴿+ E 7 Tuesday, April 9, 13

Slide 8

Slide 8 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab API Minefield ISTLab ISTLab 8 Tuesday, April 9, 13

Slide 9

Slide 9 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Crash Categories ISTLab ISTLab Memory Exhaustion Rece conditions and deadlocks Missing/Corrupted Resource Unclassified Invalid format/syntax Indexing problem Connectivity Problems Improper component identification Insufficient Permission 0 7.5 15 22.5 30 3 3 4 5 5 10 14 28 28 9 Tuesday, April 9, 13

Slide 10

Slide 10 text

ISTLab You are not to blame for all crashes! 86% app context What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab ISTLab 3% Android context 11% API context 10 Tuesday, April 9, 13

Slide 11

Slide 11 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Memory Exhaustion ISTLab ISTLab Resource auto-‐resize interface Restricted use of cache structures Cheap file formats Fixed heap memory Use profiling (﴾Tracker Tab, MAT, HeapViz, etc.)﴿ java.lang.outofmemory java.lang.outofmemory 37% Although after Honeycomb bitmaps are stored into the Dalvik heap, such exceptions continue to puzzle developers. As mobile devices become smaller and applications have heavier graphics, there is a need for thrifty memory use and good performance. 11 Tuesday, April 9, 13

Slide 12

Slide 12 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Race Conditions & Deadlocks ISTLab ISTLab Use non-‐blocking algorithms Use Java’s non-‐locking primitives and higher level concurrency abstractions. Verification (﴾Java PathExplorer)﴿ Static checking (﴾Dimmunix, Jlint, FindBugs, Julia)﴿ android.database.sqlite.SQLiteOpenHelper.getReadableDatabase android.os.AsyncTask.execute java.util.concurrent.RejectedExcutionException 28% A lot of problems arise around the SQLite and the AsyncTask classes, as they require extra attention concerning multithreading errors. 12 Tuesday, April 9, 13

Slide 13

Slide 13 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Missing/Corrupted Resources ISTLab ISTLab Use try/catch blocks Use static analysis tools like Motorola Dev checker org.jaudiotagger.audio.exceptions.InvalidAudioFrameException 14% The system fails to locate or open an external file. Note that, here, we refer to external resources, such as an image or an audio file, and not application components. 13 Tuesday, April 9, 13

Slide 14

Slide 14 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Improper Component Identification ISTLab ISTLab Check the existence of the necessary application User easy to remember codes android.content.ActivityNotFoundException 3% A lot of applications crash due to either undeclared application components (﴾i.e. activities, services, broadcast receivers, or content providers)﴿, in the AndroidManifest.xml file, or system failure to detect a suitable component for a specific task. Malicious apps can try to launch an activity in order to exploit the permissions of the running app. 14 Tuesday, April 9, 13

Slide 15

Slide 15 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Insufficient Permission ISTLab ISTLab Check the permissions related to a component, before calling it to start. Provide Clear documentation User menu android.app.Activity.startActivity java.lang.SecurityException 3% This case can be probably caused by a missing or insufficient permission for the particular activity, in the AndroidManifest.xls file. Also, there is the possibility for more than one entries to exist (﴾with different properties)﴿, for this activity, in the AndroidManifest.xls file. The system manager, however, allows unique activities characterized by a unique id. 15 Tuesday, April 9, 13

Slide 16

Slide 16 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Top 10 Root cause Exceptions ISTLab ISTLab java.lang.NullPointerException java.lang.outOfMemoryError java.lang.IllegalArgumentException java.lang.RuntimeException java.lang.IllegalStateException android.view.WindowManager$BadTokenException android.database.sqlite.SQLiteException java.lang.IndexOutOfBoundsException java.lang.ArrayIndexOutOfBoundsException java.io.FileNotFoundException 0 7.5 15 22.5 30 2 2 2 3 3 4 5 7 14 29 16 Tuesday, April 9, 13

Slide 17

Slide 17 text

10 api calls result in 17% of the crashes Tuesday, April 9, 13

Slide 18

Slide 18 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab Most Risky Android APIs ISTLab ISTLab android.app.Activity.setContentView android.app.Dialog.dismiss android.view.LayoutInflater.inflate android.app.Activity.startActivity android.graphics.BitmapFactory.decodeResource android.app.Dialog.show com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost android.graphics.Bitmap.createBItmap java.util.ArrayList.get android.view.LayoutInflater.inflate 0 1 2 3 4 1 1 1 1 1 1 1 2 2 4 18 Tuesday, April 9, 13

Slide 19

Slide 19 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab ISTLab ISTLab #DROIDCON #LIVE #BUGSENSE One of the first 10 attendees to tweet wins a mastiha liquor! http://www.bugsense.com/live 19 520M Devices Tuesday, April 9, 13

Slide 20

Slide 20 text

What BigData Analysis tell us about Android Errors @ DroidCon DE, 11 April 2013 ISTLab ISTLab ISTLab BugSense helps you analyze & troubleshoot your mobile applications in minutes http://www.bugsense.com Questions? 20 Tuesday, April 9, 13