0

So I've been mucking around in xml, and today I ran across an error which was only half printed. Here's the log:

04-06 14:25:20.201 32581 32581 E AndroidRuntime: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:378)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.ArrayAdapter.getView(ArrayAdapter.java:369)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at com.kik.view.adapters.ba.getView(SourceFile:324)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.AbsListView.obtainView(AbsListView.java:2346)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.ListView.measureHeightOfChildren(ListView.java:1281)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.ListView.onMeasure(ListView.java:1188)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.View.measure(View.java:18797)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.View.measure(View.java:18797)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.View.measure(View.java:18797)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.View.measure(View.java:18797)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.View.measure(View.java:18797)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2899)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.View.measure(View.java:18797)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1452)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.Choreographer.doCallbacks(Choreographer.java:670)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.Choreographer.doFrame(Choreographer.java:606)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:739)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5466)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-06 14:25:20.201 32581 32581 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.LayoutInflater.createView(LayoutInflater.java:645)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        ... 45 more
04-06 14:25:20.201 32581 32581 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at java.lang.reflect.Constructor.newInstance(Native Method)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        at android.view.LayoutInflater.createView(LayoutInflater.java:619)
04-06 14:25:20.201 32581 32581 E AndroidRuntime:        ... 48 more
04-06 14:25:20.201 32581 32581 E AndroidRuntime: Caused by: java.lang.UnsupportedOperationException: Failed to r

I'm afraid I can't provide more code because I'm not entirely sure which of my xml's is at fault.

Every time I crash it, no matter what, it only prints "Failed to r" then continues logging other errors, which prevents me from seeing the actual ID of the resource it's probably failing to find, and prevents me from figuring out which xml is giving me grief. I'm not too worried about the error itself; I'm more concerned with the fact logcat is failing me. Has anyone here encountered this before? Does anyone know any workarounds?

Thanks a million, ~N

EDIT: I've marked wpgbrown's answer correct, as it seems that's the root of the problem, but for any poor soul who comes across this in the future: you'll probably have to change the "entry" buffer size which is hardcoded per ROM.

Moon
  • 329
  • 2
  • 3
  • 20
  • What is your code that creates this log? – Doug Stevenson Apr 06 '16 at 19:46
  • @DougStevenson, like I said, I have many xml files, and the problem here is I'm not sure which one is the problem. And this error is preventing me from figuring it out. – Moon Apr 06 '16 at 19:47
  • So this is a crash? Not an exception that you're catching and logging yourself? – Doug Stevenson Apr 06 '16 at 19:49
  • @DougStevenson That is correct – Moon Apr 06 '16 at 19:50
  • And this line didn't help? `at com.kik.view.adapters.ba.getView(SourceFile:324)` – Doug Stevenson Apr 06 '16 at 19:51
  • @DougStevenson I'm afraid not. That particular segment of code holds no direct references to a resource (they must have been specified further up the line), but still I'm not as concerned about the crash itself as I am the fact only part of the runtime error is printed – Moon Apr 06 '16 at 19:58

1 Answers1

0

Logcat can only show a certain amount of characters for each error and log the app outputs. This has been answered before in What is the size limit for Logcat and how to change its capacity?

Also the error is to do with a problem on line 2. You may want to check over all your xml layout files and see if there are any suspicious looking line twos. The log does not really show the class the that it had a error inflating with. I would also check all custom xml objects, such as a custom LinearLayout etc... for any errors.

Community
  • 1
  • 1
wpgbrown
  • 40
  • 9
  • This looks like a step in the right direction, but even after changing the buffer size I still seem unable to get past the "r." I'm assuming at this point I'd need to modify the "entry" buffer size to get anywhere – Moon Apr 06 '16 at 20:15
  • You may then want to just check all the layout xml files and see if there are any errors that are noticeable. – wpgbrown Apr 06 '16 at 20:17