Search code examples
androidcrashandroid-6.0-marshmallowinflate-exception

App crashing through Inflate Exception on Android M


My app is working great on all tested android versions, it's just crashing directly while start on Android M with a InflateException. Here is the stack trace:

11-25 10:17:05.690 E/AndroidRuntime: FATAL EXCEPTION: main
                                 Process: abcdef, PID: 2474
                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{abcdef/abcdef.SplashScreen}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                     at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                     at android.os.Looper.loop(Looper.java:148)
                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                     at java.lang.reflect.Method.invoke(Native Method)
                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                  Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                     at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
                                     at android.app.Activity.setContentView(Activity.java:2166)
                                     at abcdef.SplashScreen.onCreate(SplashScreen.java:18)
                                     at android.app.Activity.performCreate(Activity.java:6237)
                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                     at android.os.Looper.loop(Looper.java:148) 
                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                     at java.lang.reflect.Method.invoke(Native Method) 
                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                  Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
                                     at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                     at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) 
                                     at android.app.Activity.setContentView(Activity.java:2166) 
                                     at abcdef.SplashScreen.onCreate(SplashScreen.java:18) 
                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                     at android.os.Looper.loop(Looper.java:148) 
                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                     at java.lang.reflect.Method.invoke(Native Method) 
                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                  Caused by: java.lang.reflect.InvocationTargetException
                                     at java.lang.reflect.Constructor.newInstance(Native Method)
                                     at android.view.LayoutInflater.createView(LayoutInflater.java:619)
                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                     at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) 
                                     at android.app.Activity.setContentView(Activity.java:2166) 
                                     at abcdef.SplashScreen.onCreate(SplashScreen.java:18) 
                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                     at android.os.Looper.loop(Looper.java:148) 
                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                     at java.lang.reflect.Method.invoke(Native Method) 
                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                  Caused by: java.lang.OutOfMemoryError: Failed to allocate a 74649612 byte allocation with 1130356 free bytes and 62MB until OOM
                                     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
                                     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                                     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
                                     at android.content.res.Resources.loadDrawableForCookie(Resources.java:2635)
                                     at android.content.res.Resources.loadDrawable(Resources.java:2540)
                                     at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
                                     at android.view.View.<init>(View.java:3948)
                                     at android.view.ViewGroup.<init>(ViewGroup.java:573)
                                     at android.widget.LinearLayout.<init>(LinearLayout.java:203)
                                     at android.widget.LinearLayout.<init>(LinearLayout.java:199)
                                     at android.widget.LinearLayout.<init>(LinearLayout.java:195)
                                     at java.lang.reflect.Constructor.newInstance(Native Method) 
                                     at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                     at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) 
                                     at android.app.Activity.setContentView(Activity.java:2166) 
                                     at abcdef.SplashScreen.onCreate(SplashScreen.java:18) 
                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                     at android.os.Looper.loop(Looper.java:148) 
                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                     at java.lang.reflect.Method.invoke(Native Method) 
                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

Im testing on a emulator.

Edit: In my splash screen I'm using two Images, one as a background for my LinearLayout:

image 1 details

and one ImageView on top of it:

image 1 details

74,649,612 bytes conforms about the size of my whole app, when installed on a device. Still don't know where the issue is? As said, on all other Android versions it works great without a crash.


Solution

  • Can it be something with the OpenSSL/BoringSSL flaw in apps for Android M?

    No. You have a background on a LinearLayout that is 74,649,612 bytes when decoded. You will not have memory for that. That is equivalent to an 8640 x 8640 image, which is much larger than any Android device screen.

    Find out what LinearLayout this is, and use a much smaller background image.