IllegalArgumentException before laying out ViewTapTarget on Marshmallow
See original GitHub issue- I have verified the issue exists on the latest version
- I am able to reproduce it
Version used: 1.6.0
Stack trace:
Process: com.soundcloud.android.debug, PID: 2383
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:855)
at android.graphics.Bitmap.createBitmap(Bitmap.java:834)
at android.graphics.Bitmap.createBitmap(Bitmap.java:801)
at com.getkeepsafe.taptargetview.ViewTapTarget$1.run(ViewTapTarget.java:47)
at com.getkeepsafe.taptargetview.ViewUtil$1.onGlobalLayout(ViewUtil.java:60)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:912)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1981)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1119)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6060)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Android version: 6.0 Marshmallow
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
IllegalArgumentException (Java Platform SE 7 )
public class IllegalArgumentException extends RuntimeException. Thrown to indicate that a method has been passed an illegal or inappropriate argument.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I see… Not sure what to do about this at the moment. It seems like an edge case I would need to get more user reports about for it to be worth caring about. I’ll close this issue in the meantime.
I’m guessing it is the result of a race condition. The View I’m targeting is held by an
AppBarLayoutand the animation I refer to is theexpand/collapseanimation that happens between states. Interestingly enough, this is the code for thesetExpandedmethod in AOSP:While the following call goes to:
Unfortunately there is this
mPendingActionflag that will result in a state change as a consequence of therequestLayoutcall. As you can see, it is not a simple case as I cannot really control the animation nor the view rendering in thatAppBarLayoutunfortunately, but it might be the case that theViewTapTargetis trying to set itself before the completion of the animation in theAppBarLayout. Sometimes it doesn’t happen, though, which makes me believe there is a race condition in there (specially because we’re using a separateRunnableto controlGlobalLayouting).