3

I am getting the following exception when starting my activity.

java.lang.SecurityException-Not allowed to start activity Intent { flg=0x4000000 cmp=[MY_ACTIVITY] (has extras)}-
[android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1696),
android.app.Instrumentation.execStartActivity(Instrumentation.java:1488),
android.app.Activity.startActivityForResult(Activity.java:3401),
android.app.Activity.startActivityForResult(Activity.java:3357),
android.app.Activity.startActivity(Activity.java:3597),
android.app.Activity.startActivity(Activity.java:3565), ...]

The code is pretty strait forward. Creating Intent, making sure with getPackageManager().queryIntentActivities that there is activity that filtered by this intent and performing startActivity(intent) Any ideas?

Jane
  • 43
  • 1
  • 4
  • 2
    Please post the complete stack trace, and some code of what you're trying to do. – Hiemanshu Sharma Jul 04 '14 at 17:46
  • do you have updates on your issue? anything on how to fix it? We've been receiving similar crash reports from time to time. – Ricardo Belchior Sep 15 '14 at 18:07
  • @RicardoBelchior Hi, no this issue is not happening anymore. It mainly happened when I had 3rd party sdk in my app that used to run itself in different process. It was something on their side that was causing my app to produce these errors. Sorry, it is not helping much. – Jane Sep 16 '14 at 13:06
  • have same issue, can't recognize root cause – Evgeniy Mishustin May 25 '17 at 13:23

1 Answers1

1

See the source code. We can find that the root cause of exception is ActivityManager.START_PERMISSION_DENIED:

            case ActivityManager.START_PERMISSION_DENIED:
            throw new SecurityException("Not allowed to start activity "
                    + intent);

So, when another process wants to execute some component in your app which can only be accessed internally, that will cause this exception. In other words, caller process doesn't have the permission declared in the android:permission attribute of your component, or the android:exported attribute set to false.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
jeff
  • 13
  • 2