MaterialShowcaseView
MaterialShowcaseView copied to clipboard
java.lang.IllegalStateException:
java.lang.IllegalStateException:
at android.view.RenderNode.addAnimator (RenderNode.java:786)
at android.view.RenderNodeAnimator.setTarget (RenderNodeAnimator.java:300)
at android.view.RenderNodeAnimator.setTarget (RenderNodeAnimator.java:282)
at android.animation.RevealAnimator.
at android.view.ViewAnimationUtils.createCircularReveal (ViewAnimationUtils.java:71)
at uk.co.deanwild.materialshowcaseview.CircularRevealAnimationFactory.animateInView (CircularRevealAnimationFactory.java:29)
at uk.co.deanwild.materialshowcaseview.MaterialShowcaseView.animateIn (MaterialShowcaseView.java:825)
at uk.co.deanwild.materialshowcaseview.MaterialShowcaseView$1.run (MaterialShowcaseView.java:794)
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:6119)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)
hoping you can fix this and put a new update out I can pull on gradle.
I'm getting 1700 crashes per day in my app from this but I really want to use this library
what is the app called? Might help me reproduce
Thank you for your reply. My app is here: https://play.google.com/store/apps/details?id=com.pa.lightpollutionmap
I first thought it was an issue with circularrevelanimation not being compatible with API <21, however these crashes are mostly happening on Nougat and Oreo.
They are happening on just about every type of phone model except Samsung phones for some reason. I wish I could test it better but it's not happening in the android emulator, and it's not happening on my samsung note 8.
for what it's worth this crash is not happening on my implementation of materialshowcaseview on one of my other apps, only this one.
Can't figure out why this one is generating the illegalstateexception on the circularrevealanimation but the other isn't.
here's the code for the app that is not crashing
//// showcase view tutorial
kpMeter = (ImageView) view.findViewById(R.id.kp_meter);
visiProb = (TextView) view.findViewById(R.id.visibProb);
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(500); // half second between each showcase view
config.setMaskColor(getResources().getColor(R.color.colorPrimarySCV));
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(getActivity(), SHOWCASE_ID);
sequence.setConfig(config);
sequence.addSequenceItem(kpMeter,
getString(R.string.tutorial_t1_1), getString(R.string.tutorial_got_it));
sequence.addSequenceItem(visiProb,
getString(R.string.tutorial_t1_2), getString(R.string.tutorial_got_it));
sequence.start();
Here's the code for the app that is crashing:
//// showcase view tutorial
date = (Button) findViewById(R.id.set_date_btn);
compass = (ImageView) findViewById(R.id.compass);
map = (LinearLayout) findViewById(R.id.mapcenter);
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(500); // half second between each showcase view
config.setMaskColor(getResources().getColor(R.color.color_showcasebg));
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, SHOWCASE_ID);
sequence.setConfig(config);
sequence.addSequenceItem(map,
getString(R.string.tutorial_moond_1), getString(R.string.tutorial_gotit));
sequence.addSequenceItem(date,
getString(R.string.tutorial_moond_2), getString(R.string.tutorial_gotit));
sequence.addSequenceItem(compass,
getString(R.string.tutorial_moond_3), getString(R.string.tutorial_gotit));
sequence.start();
Not much of a difference in how I'm calling it.
The only difference is that in the one that is crashing, I'm showcasing 3 items instead of 2. And I'm also showcasing a button and linearlayout instead of just a textiew and an imageview.
Both apps are targeting SDK 25 and minimum SDK of 15.
I had to get rid of materialshowcaseview from my live app version because of all of the crashes but if you want to test it, here is an older APK with it. https://www.dropbox.com/s/4utv0ntncwkpq6y/NightSkyApps-LightPollutionMap-release.apk?dl=0
In https://github.com/deano2390/MaterialShowcaseView/blob/25b345b338a3e1fe9b988bf2359646e157e291b9/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java#L777 view methods are called even though the view can already be gone for a long time. I guess this is possible because you can delay the showing of the tutorial. I would submit a PL but there are already a lot of open PLs. Is this repository still maintained @deano2390 ?
any updates?
Hi.
In my app crashs are divided:
Android Versions: Android 6.0 | 60,0% Android 7.0 | 21,4% Android 7.1 | 7,1% Android 5.1 | 7,1% Android 5.0 | 4,3%
Phones: Moto G (2nd Gen) (titan_udstv) | 8,6% Moto G (3rd Gen) (osprey_uds) | 7,1% ALCATEL ONETOUCH PIXI 4 (4) (Pixi4-4) | 5,7% ALCATEL PIXI 4 (5) (PIXI4_5_4G) | 4,3% LG K10 (2017) (mlv5) | 4,3% Galaxy J5 Prime (on5xelte) | 4,3% LG K10 LTE (m253) | 4,3% Moto G (5th Gen) (cedric) | 4,3% Moto G4 Play (harpia_t) | 2,9% Moto G (5S) (montana) | 2,9% Galaxy A7(2017) (a7y17lte) | 2,9% Moto G (3rd Gen) (osprey_udstv) | 2,9% Galaxy J5 (j5lte) | 2,9% Moto G Plus (5th Gen) (potter_nt) | 2,9% PIXI 4 (5) (Pixi4-5) | 1,4% ZenFone 2 Laser (ZE550KL) (ASUS_Z00L_63) | 1,4% LG K8 (mm1v) | 1,4% Twist Mini (S430B) | 1,4% Moto G (2nd Gen) (titan_umtsds) | 1,4% S430 Positivo Twist Mini (S430) | 1,4% Others | 31,4%
My use:
private static final int DISMISS_TEXT_COLOR = R.color.orange_A700;
private static final int DELAY = 1000;
private static final int PADDING = 24;
private static final boolean TARGET_TOUCHABLE = true;
private static void materialShowcaseView(Activity activity, View target, int dismissTextId,
int contentTextId, String singleUseUniqueId) {
new MaterialShowcaseView.Builder(activity)
.setTarget(target)
.setDismissText(activity.getString(dismissTextId))
.setDismissTextColor(activity.getResources().getColor(DISMISS_TEXT_COLOR))
.setContentText(activity.getString(contentTextId))
.setDelay(DELAY)
.singleUse(singleUseUniqueId)
.setTargetTouchable(TARGET_TOUCHABLE)
.setShapePadding(PADDING)
.show();
}
Hi,
I'm getting the same error, with pretty much the same implementation as the others. On API 22 (5.1.1), I haven't tested on other configurations for now.
Here's the stack trace:
java.lang.IllegalStateException: Cannot start this animator on a detached view! at android.view.RenderNode.addAnimator(RenderNode.java:858) at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:300) at android.view.RenderNodeAnimator.setTarget(RenderNodeAnimator.java:282) at android.animation.RevealAnimator.<init>(RevealAnimator.java:37) at android.view.ViewAnimationUtils.createCircularReveal(ViewAnimationUtils.java:53) at uk.co.deanwild.materialshowcaseview.CircularRevealAnimationFactory.animateInView(CircularRevealAnimationFactory.java:29) at uk.co.deanwild.materialshowcaseview.MaterialShowcaseView.animateIn(MaterialShowcaseView.java:825) at uk.co.deanwild.materialshowcaseview.MaterialShowcaseView$1.run(MaterialShowcaseView.java:794) 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:6934) 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)
Hope this helps to figure out the issue.
Although the root cause (accessing detached views) should be fixed in the framework, what fixed it for me was to move the tutorial start to onAttachedToWindow
:
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val sequence = MaterialShowcaseSequence(this, ...
sequence.start()
}
It seems that randomly not all views are loaded neither in onCreate nor in onResume.
must add .clearAllAnimations()
on detach method of activity lifeCycle that received in library. Or add this method:
MaterialShowcaseView.cancelAll();
Here #172 . I've tested it and it's working like a charm. waiting for the merge or more discussion.