简体   繁体   中英

How to view the entire stack trace in Android Studio?

In Android Studio (and IntelliJ afaik) when there is an error, the stack trace seems to be limited to a certain number of lines. For example:

(I have posted the full stack trace below this explanation and example.)

     **MANY MANY LINES BEFORE THIS**
     Caused by: java.lang.reflect.InvocationTargetException
     at java.lang.reflect.Constructor.newInstance(Native Method)
     at android.view.LayoutInflater.createView(LayoutInflater.java:631)
         ... 37 

I am not sure what the 37 actually is, but I feel like these editors are cutting off the full stack trace. I say this, because in my code I can prove that a null pointer exception is causing the problem that starts the stack trace. I was lucky to find it this time but it seems to be ignoring the root of my problem for some reason.

Maybe it is because of the way Android works, but the null pointer exception occurs when I inflate a custom view, and the lines is telling me the error is on is not the root of the problem; the problem is in the constructor when the view is created.

Just to reiterate, I know what the problem is this time, but it is not the first time I have had this problem. It makes debugging extremely challenging.

Here is my full stack trace.

    06-12 12:59:31.766 31807-31807/
E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                Process: , PID: 31807
                                                                                android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                             at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228)
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453)
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
                                                                                    at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
                                                                                    at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
                                                                                    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
                                                                                    at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
                                                                                    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
                                                                                    at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1418)
                                                                                    at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:144)
                                                                                    at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3783)
                                                                                    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)
                                                                                    at android.view.Choreographer.doCallbacks(Choreographer.java:695)
                                                                                    at android.view.Choreographer.doFrame(Choreographer.java:628)
                                                                                    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:7224)
                                                                                    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 #2: Error inflating class <unknown>
                                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:657)
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 

                                                                                    at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363) 
                                                                                    at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562) 
                                                                                    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900) 
                                                                                    at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1418) 
                                                                                    at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:144) 
                                                                                    at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3783) 
                                                                                    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) 
                                                                                    at android.view.Choreographer.doCallbacks(Choreographer.java:695) 
                                                                                    at android.view.Choreographer.doFrame(Choreographer.java:628) 
                                                                                    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:7224) 
                                                                                    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: java.lang.reflect.InvocationTargetException
                                                                                    at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631)
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                                                                                                                  at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363) 
                                                                                    at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562) 
                                                                                    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900) 
                                                                                    at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1418) 
                                                                                    at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:144) 
                                                                                    at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3783) 
                                                                                    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) 
                                                                                    at android.view.Choreographer.doCallbacks(Choreographer.java:695) 
                                                                                    at android.view.Choreographer.doFrame(Choreographer.java:628) 
                                                                                    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:7224) 
                                                                                    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 #2: Binary XML file line #2: Error inflating class 
                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
                                                                                    at com.subliroid.subliroidlib.customviews.InfoHeaderCard.init(InfoHeaderCard.java:47)
                                                                                    at com.subliroid.subliroidlib.customviews.InfoHeaderCard.<init>(InfoHeaderCard.java:23)
                                                                                    at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                     at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363) 
                                                                                    at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562) 
                                                                                    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900) 
                                                                                    at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1418) 
                                                                                    at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:144) 
                                                                                    at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3783) 
                                                                                    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) 
                                                                                    at android.view.Choreographer.doCallbacks(Choreographer.java:695) 
                                                                                    at android.view.Choreographer.doFrame(Choreographer.java:628) 
                                                                                    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:7224) 
                                                                                    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 #2: Error inflating class 
                                                                 at android.view.LayoutInflater.createView(LayoutInflater.java:657)
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                                                    at com.subliroid.subliroidlib.customviews.InfoHeaderCard.init(InfoHeaderCard.java:47) 
                                                                                    at com.subliroid.subliroidlib.customviews.InfoHeaderCard.<init>(InfoHeaderCard.java:23) 
                                                                                    at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                                                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
                                                                                    at android.view.LayoutInflater.inflate(LayoutInflater.java:429)     
                                                                                    at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453) 
                                                                                    at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363) 
                                                                                    at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333) 
                                                                                    at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562) 
                                                                                    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900) 
                                                                                    at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1418) 
                                                                                    at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:144) 
                                                                                    at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3783) 
                                                                                    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920) 
                                                                                    at android.view.Choreographer.doCallbacks(Choreographer.java:695) 
                                                                                    at android.view.Choreographer.doFrame(Choreographer.java:628) 
                                                                                    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:7224) 
                                                                                    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: java.lang.reflect.InvocationTargetException
                                                                                    at java.lang.reflect.Constructor.newInstance(Native Method)
                                                                                    at android.view.LayoutInflater.createView(LayoutInflater.java:631)
                                                                                    ... 37 

Sorry for the indentation, but the copy and paste is not perfect coming from the editor is not perfect, and I wanted to omit a few lines because I greatly value my work :). All of the lines I cut have different indentation on the line after, and the lines removed all referred to the same class.

您可以使用ACRA查看完整的堆栈跟踪

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