简体   繁体   中英

Getting longer error trace from logcat

Are there commends for getting longer error trace from logcat? For example I am getting the error trace below, but apparently it is not enough to indicate what the problem is:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.site.pkg, PID: 10527 android.view.InflateException: Binary XML file line #6: Binary XML file line #6: Error inflating class fragment at android.view.LayoutInflater.inflate(LayoutInflater.java:551) at android.view.LayoutInflater.inflate(LayoutInflater.java:429) at com.site.pkg.MainActivity$Adapter.onCreateViewHolder(MainActivity.java:62) at com.site.pkg.MainActivity$Adapter.onCreateViewHolder(MainActivity.java:53) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5833) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5057) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4967) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2029) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1414) at android.support.v7.widget.LinearLayoutManager.fill(LinearLa youtManager.java:1377) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:578) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3315) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:2843) at android.view.View.measure(View.java:20171) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:716) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:462) at android.view.View.measure(View.java:20171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6328) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135) at android.view.View.measure(View.java:20171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6328) at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:389) at android.view.View.measure(View.java:20171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6328) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:20171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6328) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:747) at android.widget.LinearLayout.onMeasure(LinearLayout.java:629) at android.view.View.measure(View.java:20171) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6328) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:3143) at android.view.View.measure(View.java:20171) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2644) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1599) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1891) at android.view. ViewRootImpl.doTraversal(ViewRootImpl.java:1487) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7450) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) at android.view.Choreographer.doCallbacks(Choreographer.java:695) at android.view.Choreographer.doFrame(Choreographer.java:631) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:158) at android.app.ActivityThread.main(ActivityThread.java:7237) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment at android.vie

A rule of thumb is that you can read from the top to bottom until you find a class that you know is yours and not in android internals.

Like in your stack trace you can find this line

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.site.pkg, PID: 10527 
android.view.InflateException: Binary XML file line #6: Binary XML file 
line #6: Error inflating class fragment at 
android.view.LayoutInflater.inflate(LayoutInflater.java:551) at 
android.view.LayoutInflater.inflate(LayoutInflater.java:429) at 
com.site.pkg.MainActivity$Adapter.onCreateViewHolder(MainActivity.java:62) 
at

where the interesting part is MainActivity$Adapter.onCreateViewHolder(MainActivity.java:62)

so you should begin your investigation in your MainActivity.java at line 62 .

But in your case, where you have this error Error inflating class fragment at android.view.LayoutInflater.inflate(LayoutInflater.java:551) . Most probably something is wrong in the fragment layout which you try to inflate.

So check your layout xml file, look for errors, maybe you're trying to add a custom widget which is broken or doesn't exist (just a guess of course).

Hopefully I pointed you in the right direction at least.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM