java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.android.server.am.ActivityRecord$Token

tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    requestPermissions not showing permission dialog on device, works well on Android studio emulator

    Stack Overflow | 10 months ago | priyank brahmbhatt
    java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.android.server.am.ActivityRecord$Token

Root Cause Analysis

  1. java.lang.ClassCastException

    android.os.BinderProxy cannot be cast to com.android.server.am.ActivityRecord$Token

    at com.android.server.am.ActivityRecord.forTokenLocked()
  2. Android
    ActivityManagerService.startActivity
    1. com.android.server.am.ActivityRecord.forTokenLocked(ActivityRecord.java:424)
    2. com.android.server.am.ActivityStack.isInStackLocked(ActivityStack.java:467)
    3. com.android.server.am.ActivityStackSupervisor.isInAnyStackLocked(ActivityStackSupervisor.java:592)
    4. com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1484)
    5. com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1090)
    6. com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4077)
    7. com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4064)
    7 frames
  3. Android Platform
    ActivityManagerNative.onTransact
    1. android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:162)
    1 frame
  4. Android
    ActivityManagerService.onTransact
    1. com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2670)
    1 frame
  5. Android Platform
    Binder.execTransact
    1. android.os.Binder.execTransact(Binder.java:453)
    1 frame