android-target-tooltip icon indicating copy to clipboard operation
android-target-tooltip copied to clipboard

NPE Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference

Open linxueyi2230 opened this issue 8 years ago • 7 comments

W/System.err: java.lang.NullPointerException: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference W/System.err: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3497) W/System.err: at android.view.View.updateDisplayListIfDirty(View.java:14445) W/System.err: at android.view.View.getDisplayList(View.java:14524) W/System.err: at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:279) W/System.err: at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:285) W/System.err: at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:335) W/System.err: at android.view.ViewRootImpl.draw(ViewRootImpl.java:3009) W/System.err: at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2823) W/System.err: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2434) W/System.err: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1335) W/System.err: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6710) W/System.err: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800) W/System.err: at android.view.Choreographer.doCallbacks(Choreographer.java:603) W/System.err: at android.view.Choreographer.doFrame(Choreographer.java:572) W/System.err: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786) W/System.err: at android.os.Handler.handleCallback(Handler.java:815) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:104) W/System.err: at android.os.Looper.loop(Looper.java:192) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5886) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1031) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)

linxueyi2230 avatar Jul 19 '17 07:07 linxueyi2230

I am getting a NPE in the 1.3.15 version also. The issue looks similar. This happened to me when re-running an app after it had been left sitting for 20 minutes:

                                              java.lang.NullPointerException: Attempt to read from field 'int android.graphics.Point.x' on a null object reference
                                                   at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:978)
                                                   at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:933)
                                                   at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:925)
                                                   at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.onLayout(Tooltip.java:717)
                                                   at android.view.View.layout(View.java:16992)
                                                   at android.view.ViewGroup.layout(ViewGroup.java:5409)
                                                   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:579)
                                                   at android.widget.FrameLayout.onLayout(FrameLayout.java:514)
                                                   at android.view.View.layout(View.java:16992)
                                                   at android.view.ViewGroup.layout(ViewGroup.java:5409)
                                                   at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2483)
                                                   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2185)
                                                   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1314)
                                                   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7057)
                                                   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:829)
                                                   at android.view.Choreographer.doCallbacks(Choreographer.java:606)
                                                   at android.view.Choreographer.doFrame(Choreographer.java:576)
                                                   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:815)
                                                   at android.os.Handler.handleCallback(Handler.java:739)
                                                   at android.os.Handler.dispatchMessage(Handler.java:95)
                                                   at android.os.Looper.loop(Looper.java:145)
                                                   at android.app.ActivityThread.main(ActivityThread.java:6939)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at java.lang.reflect.Method.invoke(Method.java:372)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

LeeHounshell avatar Jul 27 '17 21:07 LeeHounshell

Has anybody found a work around?

johnernest02 avatar Oct 12 '17 10:10 johnernest02

Has anybody found a work around?

johnernest02 avatar Oct 12 '17 10:10 johnernest02

In my case I pulled the tooltip into my project as a library and edited it. I also added ability to resize the text.

On Thu, Oct 12, 2017 at 3:12 AM, dev-JE02 [email protected] wrote:

Has anybody found a work around?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sephiroth74/android-target-tooltip/issues/82#issuecomment-336084414, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-9lRj8PZvE7iaGlsggJNbCDlKznovCks5sreXxgaJpZM4OcWww .

LeeHounshell avatar Oct 12 '17 16:10 LeeHounshell

What was actually causing the NPE? I get this when closing or destroying a fragment while the tooltip is still showing. I implemented RxLifecycle and even bound it to the fragment's lifecycle but it still keeps crashing

On 13 Oct 2017 00:18, "Lee Hounshell" [email protected] wrote:

In my case I pulled the tooltip into my project as a library and edited it. I also added ability to resize the text.

On Thu, Oct 12, 2017 at 3:12 AM, dev-JE02 [email protected] wrote:

Has anybody found a work around?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/sephiroth74/android-target-tooltip/issues/82# issuecomment-336084414>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA- 9lRj8PZvE7iaGlsggJNbCDlKznovCks5sreXxgaJpZM4OcWww> .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sephiroth74/android-target-tooltip/issues/82#issuecomment-336188580, or mute the thread https://github.com/notifications/unsubscribe-auth/AKDQgpds_yGsf05U7n-huw7yEGGuxtY4ks5srjvGgaJpZM4OcWww .

johnernest02 avatar Oct 12 '17 16:10 johnernest02

This will stop the NPE

Lee Hounshell (master *) tooltip $ git show 77b42d287623cc7b682fd40a30aaad6a29cc5449 commit 77b42d287623cc7b682fd40a30aaad6a29cc5449 Author: Lee Hounshell [email protected] Date: Thu Jul 27 20:38:05 2017 -0700

fix NPE

diff --git a/tooltip/src/main/java/it/sephiroth/android/library/tooltip/Tooltip.java b/tooltip/sr old mode 100644 new mode 100755 index e28d644..4eebc8c

a/tooltip/src/main/java/it/sephiroth/android/library/tooltip/Tooltip.java +++ b/tooltip/src/main/java/it/sephiroth/android/library/tooltip/Tooltip.java @@ -972,7 +972,9 @@ public final class Tooltip {

         if (mViewRect == null) {
             mViewRect = new Rect();
  •            mViewRect.set(mPoint.x, mPoint.y + statusbarHeight,
    

mPoint.x, mPoint.y + statusb

  •            if (mPoint != null) {
    
  •                mViewRect.set(mPoint.x, mPoint.y + statusbarHeight,
    

mPoint.x, mPoint.y + sta

  •            }
           }
    
           final int screenTop = mScreenRect.top + mTopRule;
    

On Thu, Oct 12, 2017 at 9:21 AM, dev-JE02 [email protected] wrote:

What was actually causing the NPE? I get this when closing or destroying a fragment while the tooltip is still showing. I implemented RxLifecycle and even bound it to the fragment's lifecycle but it still keeps crashing

On 13 Oct 2017 00:18, "Lee Hounshell" [email protected] wrote:

In my case I pulled the tooltip into my project as a library and edited it. I also added ability to resize the text.

On Thu, Oct 12, 2017 at 3:12 AM, dev-JE02 [email protected] wrote:

Has anybody found a work around?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/sephiroth74/android-target-tooltip/issues/82# issuecomment-336084414>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AA- 9lRj8PZvE7iaGlsggJNbCDlKznovCks5sreXxgaJpZM4OcWww> .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/sephiroth74/android-target-tooltip/issues/82# issuecomment-336188580>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AKDQgpds_yGsf05U7n- huw7yEGGuxtY4ks5srjvGgaJpZM4OcWww> .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sephiroth74/android-target-tooltip/issues/82#issuecomment-336189452, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-9lQ5tsG9z-7omNy0V4Kx6p1qdYwCxks5srjyIgaJpZM4OcWww .

LeeHounshell avatar Oct 12 '17 16:10 LeeHounshell

This really made me appreciate that github exists. Thank you very much for lending me a hand here!

johnernest02 avatar Oct 12 '17 16:10 johnernest02