2013-08-20 64 views
1

我看到在android.view.GLES20RecordingCanvas.drawPatch()NullPointerException異常崩潰報告的NullPointerException在android.view.GLES20RecordingCanvas

Android的源是在這裏http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/view/GLES20RecordingCanvas.java

似乎在線路97轟然4.0 .x,當活動有硬件加速時。

堆棧跟蹤:

java.lang.NullPointerException 
at android.view.GLES20RecordingCanvas.drawPatch(GLES20RecordingCanvas.java:97) 
at android.graphics.NinePatch.draw(NinePatch.java:125) 
at android.graphics.drawable.NinePatchDrawable.draw(NinePatchDrawable.java:189) 
at android.widget.ScrollBarDrawable.drawThumb(ScrollBarDrawable.java:178) 
at android.widget.ScrollBarDrawable.draw(ScrollBarDrawable.java:137) 
at android.view.View.onDrawVerticalScrollBar(View.java:9532) 
at android.view.View.onDrawScrollBars(View.java:9476) 
at android.view.View.draw(View.java:11091) 
at android.widget.AbsListView.draw(AbsListView.java:3428) 
at android.view.View.getDisplayList(View.java:10455) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.ViewGroup.drawChild(ViewGroup.java:2858) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2497) 
at android.view.View.draw(View.java:11067) 
at android.view.View.getDisplayList(View.java:10455) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2605) 
at android.view.View.getDisplayList(View.java:10418) 
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:879) 
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1955) 
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1661) 
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2505) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:4945) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:511) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
at dalvik.system.NativeStart.main(Native Method) 

是否有一個簡單的辦法解決這個,還是我只是需要關閉硬件加速受影響的活動?

+0

Post some code ... –

+0

沒有相關的代碼 - 當我試圖恢復4.0.x設備上的後臺活動時發生這種情況。你可以在崩潰中看到,它看起來像試圖繪製ListView滾動縮略圖時崩潰。 – theelfismike

+0

你試過我的回答嗎?請讓我知道它是否對你有所幫助。 – Saran

回答

1

有辦法解決這個問題。它歸結爲禁用硬件加速之一:

  • 的問題查看,與myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  • 特定操作系統版本(例如超過JB MR1所有老年人),與these tricks

信息來源於this question

+1

通過調用setLayerType(View.LAYER_TYPE_SOFTWARE,null)爲我工作;在我自己的Views構造函數中 – swisscoder

相關問題