Can't launch a few specific apps in emulator or android inspector

I’m having a problem launching a few specific apps in the emulator and in Android Inspector. This same process is working successfully for several other apps, but there are a few that don’t work. Wondering if anyone has faced this and might know how to proceed.

This is for the Trello app, trying to launch into the Welcome/Log In screen:

From the terminal, I am running this command to determine the app package and app activity:

    adb shell dumpsys window | grep -E 'mCurrentFocus'
      mCurrentFocus=Window{9ae684d u0 com.trello/com.trello.feature.authentication.WelcomeActivity}

I’m then using this command to try to launch the trello app from the terminal:

adb -P 5037 -s emulator-5554 shell am start -W -n com.trello/com.trello.feature.authentication.WelcomeActivity

That command works to launch multiple other apps I’m using, but it is not working so far for a few apps I’ve tried, e.g. Trello and VRBO.

Instead of the app launching, I get this error in the terminal:

Exception occurred while executing 'start':
java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.trello/.feature.authentication.WelcomeActivity } from null (pid=13084, uid=2000) not exported from uid 10154
at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1032)
at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:999)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:669)
at com.android.server.wm.ActivityTaskManagerService.startActivityAndWait(ActivityTaskManagerService.java:1338)
at com.android.server.am.ActivityManagerService.startActivityAndWait(ActivityManagerService.java:3687)
at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:539)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:186)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10520)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5027)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2883)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)

If I try to launch the VRBO app in Android Inspector session with the following capabilities: (similar capabilities and error for Trello app also)

{
  "platformName": "android",
  "appium:platformVersion": "11",
  "appium:deviceName": "sdk_gphone_x86",
  "appium:automationName": "UIAutomator2",
  "appium:appPackage": "com.vrbo.android",
  "appium:appActivity": "com.vacationrentals.homeaway.activities.MainActivity"
}

…I get this error:

Failed to create session.
An unknown server-side error occurred while processing the command.
Original error: Cannot start the 'com.vrbo.android' application.
Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting.
Original error: Error executing adbExec.
Original error: 'Command '/Users/daniel/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -W -n com.vrbo.android/com.vacationrentals.homeaway.activities.MainActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' exited with code 255';
Command output: Exception occurred while executing 'start': java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.vrbo.android/com.vacationrentals.homeaway.activities.MainActivity } from null (pid=13420, uid=2000) not exported from uid 10162 at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1032) at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:999) at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:669) at com.android.server.wm.ActivityTaskManagerService.startActivityAndWait(ActivityTaskManagerService.java:1338) at com.android.server.am.ActivityManagerService.startActivityAndWait(ActivityManagerService.java:3687) at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:539) at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:186) at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98) at android.os.ShellCommand.exec(ShellCommand.java:44) at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:10520) at android.os.Binder.shellCommand(Binder.java:929) at android.os.Binder.onTransact(Binder.java:813) at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:5027) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2883) at android.os.Binder.execTransactInternal(Binder.java:1159) at android.os.Binder.execTransact(Binder.java:1123)

But similar to launching from the terminal, I am able to use this same process to launch several other apps in Android Inspector sessions.

Is there a known issue where some apps just won’t launch this way? Or they really need slightly different app package and app activity values than what’s being returned from this command?
adb shell dumpsys window | grep -E 'mCurrentFocus'

The appium trouble shooting docs suggest the following:
Such error might be the indication of the fact that the combination of application package and activity name, which has been passed to Appium as appPackage / appActivity (or auto detected implicitly), is not the correct one to start the application under test. As a solution, it is necessary to check the correct values with the application developer

But as I’ve shown above, I believe I am correctly passing in the app package and app activity values.

Any ideas or help would be much appreciated, thanks!

Check the application manifest to figure out which activity class is marked as launchable. Read, for example, https://automationchronicles.com/error-when-opening-chrome-on-android-13-via-adb/

Thank you for that tip. I read that article. It seems like a similar problem for sure. Their solution relied on inspecting the Chrome apk file.

…in our case it means that we must ensure that all parameters in our am start command match declaration in Chrome manifest file. In order to obtain Chrome manifest file we need to get Chrome apk file, and one way to do that is to download it from APKMirror.

Unfortunately I do not have access to the apk files for the 2 files I am trying to test with (Trello an VRBO.) Perhaps I will just need to use other apps for my practice but was hoping to figure this issue out in case there is a good lesson to be learned here.

Huge thanks to you Mykola!!! That article explained the fix perfectly. I was able to download the apk file (previously I was not aware that there is a way to do that from the play store, but it turns out there is), then inspect the manifest file, then with a bit of trial and error I was able to find an activity name that worked. In case anyone else reading this wants to launch the trello app from adb, here is a good command to do it.

adb -P 5037 -s emulator-5554 shell am start -W -n com.trello/com.trello.feature.launch.UriHandlerActivity

I’m assuming the same investigation would lead to the correct activity name to launch the VRBO app or any other app that isn’t working with the activity name returned by the adb shell dumpsys window | grep -E 'mCurrentFocus' command.