Switching between two apps

Hello, I’m trying to switch from an app to messages to grab a reset password code and back to the app but I’m getting a server-side error.

`"An unknown server-side error occurred while processing the command. 
Original error: Cannot start the 'com.user.android.thoag' application. 
Original error: Error executing adbExec. 
Original error: 'Command ''C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools\\adb.exe' -P 5037 -s 73QDU17616006662 shell am start -W -n com.user.android.thoag/com.user.android.thoag.BottomBarActivity -S' exited with code 1'; 
Stderr: 'java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.user.android.thoag/.BottomBarActivity } from null (pid=11201, uid=2000) not exported from uid 10143"`

As you can see from the error message it’s “Permission Denial” exception. Is there a way around this problem?

what command are you using to launch the app?

driver = new AndroidDriver(url, capabilities);
at the start

driver.startActivity(new Activity(MessageAppPkg, MessageAppAct));
to open the messaging app (android’s default pp)

it’s all fine unit this point

driver.startActivity(new Activity(ThoagAppPkg, ThoagAppPkg+".BottomBarActivity"));
Thoag is the application name
I suspect the problem happens when I try to switch is the activity “BottomBarActivity”

there will be an adb command in the appium commands which results in the error. try to run it manually, if it gives an error, it might not be related to appium.

Unfortunately it gives the same error message if i used "BottomBarActivity"

C:\WINDOWS\system32>adb  -P 5037 -s 73QDU17616006662 shell am start -W -n com.us
er.android.thoag/com.user.android.thoag.BottomBarActivity -S

Stopping: com.user.android.thoag
Starting: Intent { cmp=com.user.android.thoag/.BottomBarActivity }
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000
 cmp=com.user.android.thoag/.BottomBarActivity } from null (pid=19690, uid=2000)
 not exported from uid 10143
        at android.os.Parcel.readException(Parcel.java:1665)
        at android.os.Parcel.readException(Parcel.java:1618)
        at android.app.ActivityManagerProxy.startActivityAndWait(ActivityManager
Native.java:3204)
        at com.android.commands.am.Am.runStart(Am.java:630)
        at com.android.commands.am.Am.onRun(Am.java:388)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
        at com.android.commands.am.Am.main(Am.java:121)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)

Same command works fine with another activity "MainActivity"

C:\WINDOWS\system32>adb -P 5037 -s 73QDU17616006662 shell am start -W -n com.use
r.android.thoag/com.user.android.thoag.MainActivity -S

Stopping: com.user.android.thoag
Starting: Intent { cmp=com.user.android.thoag/.MainActivity }
Status: ok
Activity: com.user.android.thoag/.MainActivity
ThisTime: 567
TotalTime: 567
WaitTime: 577
Complete

Yes so its a problem with your application, and not Appium itself. Since even command line gives the same error.
Also since you say that MainActivity works fine, try out some other activity.
It could be that the BottomBarActivity might be restricted.

As it seems you are right. I thought I’m might find a way around it but it seems thats not gonna happen.
Thank you for your time @Mayuresh_Shirodkar

:slightly_smiling_face: yup no problem