2016-11-11 41 views
0

是否有讚揚從logcat獲得更長的錯誤跟蹤?比如我得到下面的錯誤跟蹤,但顯然是不夠的指出問題所在:從logcat獲取更長的錯誤跟蹤

E/AndroidRuntime:致命異常:主要過程:com.site.pkg,PID: 10527機器人.view.InflateException:二進制XML文件行#6:二進制 XML文件行#6:錯誤擴展類片段 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 androi d.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) 在android.support.v7.widget.LinearLayoutManager $ LayoutState.next(LinearLayoutManager.java:2029) 在android.support.v7.widget.LinearLayoutManager.layoutChunk( LinearLayoutManager.java:1414) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1377) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:578) at android。 support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3315) at android在android.widget.RelativeLayout.measureChildHorizo​​ntal(RelativeLayout.java:716) (android.view.java:20171) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6328) at android.device.View.measure(View.java:20171) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:462) 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.widg et.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:389) 在android.view.View.measure(View.java:20171) 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6328) 在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。在android.widget.LineoutLayout.measureVertical(LinearLayout.java:747) at android.widget.LinearLayout.onMeasure(LinearLayout.java:629) at android.view.View.measure(())中的measureChildBeforeLayout(LinearLayout.java:1464) View.java:20171) at android.view.ViewGroup.measureChildWithMar gins(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.View.RootImpl.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。運行(ViewRootImpl.java:7450) at android.view.Choreographer $ CallbackRecord.run(Choreographer.java:920) at android.view.Choreographer.doCallbacks(Choreographer.java:695) at android.view.Choreographer。在android.os.Handler上的android.os.Handler.handleCallback(Handler.java:739) 上的doFrame(Choreographer.java:631) (android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:906) )。 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。調用(Native Method) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1230) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)產生的原因:android.view.InflateException:二進制XML文件線#6: 錯誤充氣類片段 在android.vie

+1

好像你只需要在這裏看看'com.site.pkg.MainActivity $ Adapter.onCreateViewHolder(MainActivity.java:62)' –

+0

這還不夠。閱讀以下鏈接的評論。 http://stackoverflow.com/questions/40513614/how-to-get-viewpager-to-behave-like-a-vertical-listview?noredirect=1#comment68340411_40513614 –

+0

恕我直言,我會建議研究這個'InflateException'爲什麼這發生並研究一些示例問題和答案,再加上我猜測有一些第三方庫存在記錄(從未使用過),所以也許別人會指導你更好:) –

回答

0

經驗法則是,您可以從頂部到底部閱讀,直到找到一個您認識的類,而不是android內部的類。

就像在你的堆棧跟蹤,你可以找到這一行

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 

其中有趣的部分是MainActivity$Adapter.onCreateViewHolder(MainActivity.java:62)

所以你應該在線路62開始你的調查,你MainActivity.java

但在你的情況下,你有這個錯誤Error inflating class fragment at android.view.LayoutInflater.inflate(LayoutInflater.java:551)。 在嘗試膨脹的片段佈局中,很可能是錯誤的。

因此,檢查您的佈局xml文件,尋找錯誤,也許你正在嘗試添加一個已損壞或不存在的自定義小部件(只是猜測當然)。

希望我至少指出你在正確的方向。