3

While i try to launch app via adb i am getting below exception

java.lang.SecurityException: Permission Denial: starting Intent

CMD used : adb shell am start -n pakage/mainactivity name

dolittle
  • 310
  • 1
  • 5
  • 13

1 Answers1

6

Make sure that the activity you are launching has the right intent action and category. For example:

<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />

Check the android docs for more info:
https://developer.android.com/guide/topics/manifest/manifest-intro
https://developer.android.com/reference/android/content/Intent

There's also this very similar question with more details on android manifests:
Android - java.lang.SecurityException: Permission Denial: starting Intent

Nico
  • 169
  • 6
  • 1
    i am able to launch the same app in an rooted device, where as in un-rooted devices i cann't. – dolittle Sep 10 '18 at 08:16
  • Just to add to the @PadmanabanGanapathy's comment - if you want this for testing purposes (i.e. don't want to add `android:exported="true"` to you `AndroidManifest.xml`, you need to run `adb root` and then `adb shell am start -n pakage/mainactivity name` – petrkotek Jan 16 '20 at 01:17