user2201789
user2201789

Reputation: 1203

Android appium Permission Denial: starting Intent

Anyone can help me to see this permission issue is due to the app which I need developer to re-build with permission open? or it is my adb command issue? or the intent argument is used wrongly?

At android phone,

1st screen: com.ninetest.hd3.test.testDetectActivity

2nd screen:

com.ninetest.hd3.activity.MailActivity

When executing adb command with 1st screen, error occurred. if I changed the appActivity to 2nd screen then no issue. but i cannot skip first screen if I need to run appium test cases.

I cannot skip the intent argument as well, otherwise the app which installed under work profile is not launced.

**error**

C:\Users\tester>adb shell am start --user 10 -n "com.ninetest.hd3.work.cac/com.ninetest.hd3.test.testDetectActivity"
Starting: Intent { cmp=com.ninetest.hd3.work.cac/com.ninetest.hd3.test.testDetectActivity }
Security exception: Permission Denial: starting Intent { flg=0x10000000 cmp=com.ninetest.hd3.work.cac/com.ninetest.hd3.test.testDetectActivity } from null (pid=9047, uid=2000) not exported from uid 1010396

java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.ninetest.hd3.work.cac/com.ninetest.hd3.test.testDetectActivity } from null (pid=9047, uid=2000) not exported from uid 1010396
        at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1386)
        at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:921)
        at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:694)
        at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1932)
        at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:625)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1707)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1603)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4218)
        at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:518)
        at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:172)
        at android.os.ShellCommand.exec(ShellCommand.java:104)
        at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:12243)
        at android.os.Binder.shellCommand(Binder.java:916)
        at android.os.Binder.onTransact(Binder.java:790)
        at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5310)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3383)
        at android.os.Binder.execTransactInternal(Binder.java:1056)
        at android.os.Binder.execTransact(Binder.java:1029)

Upvotes: 0

Views: 3338

Answers (2)

nmdaz
nmdaz

Reputation: 109

If you only have the APK you can decompile, modify the AndroidManifest.xml file (android:exported="true" in the Activity you need) and recompile. You can use https://github.com/AndnixSH/APKToolGUI for this purpose.

Upvotes: 0

Jeferson Macedo
Jeferson Macedo

Reputation: 725

I think You need to set android:exported="true" in your AndroidManifest.xml file in your Activity

Upvotes: 2

Related Questions