deano2390 / MaterialShowcaseView

A Material Design themed ShowcaseView for Android
Apache License 2.0
2.71k stars 526 forks source link

Crash java.lang.IllegalArgumentException: width and height must be > 0 #94

Open Punpuf opened 8 years ago

Punpuf commented 8 years ago

On Nexus 9 developer preview for android N, app crashes when in portrait mode(and height is less than half of device's height).

showcase slipt

showcase crash

Logs:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.package.name, PID: 11614 java.lang.IllegalArgumentException: width and height must be > 0 at android.graphics.Bitmap.createBitmap(Bitmap.java:877) at android.graphics.Bitmap.createBitmap(Bitmap.java:856) at android.graphics.Bitmap.createBitmap(Bitmap.java:823) at uk.co.deanwild.materialshowcaseview.MaterialShowcaseView.onDraw(MaterialShowcaseView.java:154) at android.view.View.draw(View.java:17056) at android.view.View.updateDisplayListIfDirty(View.java:16038) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3699) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3679) at android.view.View.updateDisplayListIfDirty(View.java:16001) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:672) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:678) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:786) at android.view.ViewRootImpl.draw(ViewRootImpl.java:2773) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2581) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2191) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1240) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6298) 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:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:5969) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:801) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)

Karthi-R commented 8 years ago

Is there any workaround for this bug?

kangsLee commented 7 years ago

It can't receive width and height value. so, You should use 'isInMultiWindowMode()' method in Activity class.

reference https://developer.android.com/reference/android/app/Activity.html?hl=ko#isInMultiWindowMode()