javafatal-errorpidbinary-xml

I am fairly new to programming. Having FATAL EXCEPTION error. Binary XML file line #0


FATAL EXCEPTION: main
Process: com.onyebuchboss.bossweatherbitcoinapp, PID: 11494
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.onyebuchboss.bossweatherbitcoinapp/com.onyebuchboss.bossweatherbitcoinapp.OptionActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class <unknown>
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2743)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1544)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:203)
    at android.app.ActivityThread.main(ActivityThread.java:6293)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1094)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class <unknown>
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
    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:717)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
    at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
    at com.onyebuchboss.bossweatherbitcoinapp.OptionActivity.onCreate(OptionActivity.java:23)
    at android.app.Activity.performCreate(Activity.java:6702)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2696)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1544)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:203)
    at android.app.ActivityThread.main(ActivityThread.java:6293)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1094)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:955)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 493807116 byte allocation with 4194304 free bytes and 155MB until OOM
    at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
    at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:655)
    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:483)
    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1160)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:841)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:641)
    at android.content.res.Resources.loadDrawable(Resources.java:976)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
    at android.view.View.<init>(View.java:4348)
    at android.view.ViewGroup.<init>(ViewGroup.java:616)
    at android.widget.RelativeLayout.<init>(RelativeLayout.java:268)
    at android.widget.RelativeLayout.<init>(RelativeLayout.java:264)
    at android.widget.RelativeLayout.<init>(RelativeLayout.java:260)

Solution

  • The useful part of this error is the java.lang.OutOfMemoryError part. Going down from that, you can see stack calls related to decoding a bitmap. What this is saying is that you have a large bitmap that is causing an out of memory error when loading.

    Check all ImageViews in your xml and look for large images.

    When you get crashes loading layouts, the actual errors are usually hidden further into the crash log.