ShowcaseView icon indicating copy to clipboard operation
ShowcaseView copied to clipboard

Crazy amounts of crashes .updateBitmap IllegalArgumentException

Open easycheese opened this issue 9 years ago • 14 comments

I just integrated Showcaseview again after a two year hiatus and am regretting it...

It works fine on my test devices but numerous users are getting crashes and the stacktrace is from the library at:

Fatal Exception: java.lang.IllegalArgumentException width and height must be > 0 com.github.amlcurran.showcaseview.ShowcaseView.updateBitmap (ShowcaseView.java:211) com.github.amlcurran.showcaseview.ShowcaseView.access$100 (ShowcaseView.java:51) com.github.amlcurran.showcaseview.ShowcaseView$1.run (ShowcaseView.java:187)

ShowcaseView is being run 5 seconds after launch (so the view is definitely created) and I'm targeting a point, not a specific view (just in case).

I searched the web and found a few things here and there, most of the responses were not helpful. Currently the only solution I have is calling the showcase a single time (therefore it will always work on the second launch).

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {

                new ShowcaseView.Builder(MainActivity.this)
                        .setTarget(new PointTarget(250, 350))
                        .setContentTitle(getString(R.string.showcase_title))
                        .setContentText(getString(R.string.showcase_description))
                        .singleShot(125)
                        .setStyle(R.style.CustomShowcaseTheme)
                        .build();

            }
        }, 5000);
    }

easycheese avatar Jan 04 '16 01:01 easycheese

Agree, got the same issue

enttq avatar Jan 08 '16 17:01 enttq

exact same error here

vicpinm avatar Jan 13 '16 12:01 vicpinm

I figured out the problem. I was launching a tutorial first and this would trigger at the same time. Because the tutorial was visible first, this would cause a crash. Explicitly calling it AFTER the tutorial will prevent the crash.

easycheese avatar Jan 16 '16 00:01 easycheese

got the same issue

vamshinagamalla avatar Jan 18 '16 07:01 vamshinagamalla

just had the same issue in my app.

I've targeted a textview in the first row of a recyclerView via the onBindViewHolder (just to see if it would work)

@Override
        public void onBindViewHolder(ViewHolder viewHolder, int i) {

        [...]

            if(i == 0){
                Log.d(TAG,"showHelp from onBindViewHolder");
                showHelp(viewHolder.tv_verify_list_billed);
            }
  private void showHelp(View view){

        if(view == null){
            Log.d(TAG,"showHelp view was null");
            return;
        }

        ViewTarget vt = new ViewTarget(view);

        new ShowcaseView.Builder(getActivity())
                .setTarget(vt)
                .setContentTitle(getString(R.string.list_title))
                .setContentText(getString(R.string.list_content))
                .setStyle(R.style.CustomShowcaseTheme)
                .hideOnTouchOutside()
                .replaceEndButton(R.layout.showcase_button)
                //.singleShot(ShowcaseView_SSIDs.InventoryList.hashCode())
                .build();
    }

it works perfectly on first load of the recyclerView list, but when i swipeRefresh the recyclerView i get the error.

Hopefully this helps to reproduce it for bug fixing.

java.lang.IllegalArgumentException: width and height must be > 0
                                                                               at android.graphics.Bitmap.createBitmap(Bitmap.java:934)
                                                                               at android.graphics.Bitmap.createBitmap(Bitmap.java:913)
                                                                               at android.graphics.Bitmap.createBitmap(Bitmap.java:880)
                                                                               at com.github.amlcurran.showcaseview.ShowcaseView.updateBitmap(ShowcaseView.java:211)
                                                                               at com.github.amlcurran.showcaseview.ShowcaseView.access$100(ShowcaseView.java:51)
                                                                               at com.github.amlcurran.showcaseview.ShowcaseView$1.run(ShowcaseView.java:187)
                                                                               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:6872)
                                                                               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)

d34n0s avatar Jan 20 '16 06:01 d34n0s

Interesting, thanks for the reproduction steps. I'd imagine that this isn't exactly how best to use showcaseview with a RecyclerView but will take a look and report back!

amlcurran avatar Jan 20 '16 09:01 amlcurran

@easycheese can you tell me what devices are having the issue?

amlcurran avatar Jan 20 '16 09:01 amlcurran

@amlcurran as far as I can tell it will happen on any device

easycheese avatar Jan 20 '16 18:01 easycheese

I have the same issue

Fornori avatar Feb 19 '16 07:02 Fornori

Any idea to fix this?

Fornori avatar Feb 19 '16 07:02 Fornori

@Fornori Can you give me more details of what you're? I have no way of reproducing this right now because I'm not sure what is happening. Any code that reproduces the crash will be great

amlcurran avatar May 12 '16 08:05 amlcurran

Sorry, but code was gone. I replaced it by another. And now can't reproduce. If the app will crash again. I will write full description.

Fornori avatar May 12 '16 08:05 Fornori

Same problem here

cazador4 avatar Jul 05 '16 20:07 cazador4

I believe this is a duplicate of https://github.com/amlcurran/ShowcaseView/issues/197, which should be fixed in com.github.amlcurran.showcaseview:library:5.4.3.

barbeau avatar Jul 05 '16 20:07 barbeau