Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
717 views
in Technique[技术] by (71.8m points)

android - IllegalArgumentException in ActivityManagerProxy

Issue: ActivityA starts ActivityB with shared element transitions intermittently crashes Not consistently reproducible Api levels: 23, 24 and 25

Code to launch activity:

Intent intent = new Intent(this, ActivityB.class);
Pair<View, String> logoTransition = Pair.create(logo, getString(R.string.transition_logo));
Pair<View, String> logoTextTransition = Pair.create(logoText, getString(R.string.transition_logo_text));
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this, logoTransition, logoTextTransition);
ActivityCompat.startActivity(this, intent, options.toBundle());

Stacktrace (API 23):

Exception java.lang.IllegalArgumentException:
android.os.Parcel.readException (Parcel.java:1606)
android.os.Parcel.readException (Parcel.java:1555)
android.app.ActivityManagerProxy.isTopOfTask (ActivityManagerProxy.java:4787)
android.app.Activity.isTopOfTask (Activity.java:5753)
android.app.Activity.cancelInputsAndStartExitTransition (Activity.java:4075)
android.app.Activity.startActivityForResult (Activity.java:4052)
android.app.Activity.startActivity (Activity.java:4312)
android.support.v4.content.ContextCompat.startActivity (ContextCompat.java)
__null__.getDrawable (ContextCompat.java)
__null__.isDeviceProtectedStorage (ContextCompat.java)
com.my.app.activity.ActivityA.startMainActivity (ActivityA.java)

Does anyone know what causes this behaviour? Any proposed fix for this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I suppose, you should not use methods from support library for that versions. Sure, I can't figure out, from your existing issue due of random stacktrace.

Since Tranlsation Scene introduced form 4.4. You can include api deprecation. Moreover, it's recommended, otherwise, why we need both types?

 if (Build.VERSION.SDK_INT >= 21) {
       ActivityOptions options = ActivityOptions
      .makeSceneTransitionAnimation(this, logoTransition, logoTextTransition);
       startActivity(this, intent, options.toBundle());
    } 
  else {
       ActivityOptionsCompat options = ActivityOptionsCompat
      .makeSceneTransitionAnimation(this, logoTransition, logoTextTransition);
       ActivityCompat.startActivity(this, intent, options.toBundle());
    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...