0

I've just started using Appium with Python and I'm running into trouble when trying to launch the Twitter app.

I have tried to launch the play store by typing:

adb shell "dumpsys window windows | grep -E 'mCurrentFocus'"

into a command prompt to get the appActivity and appPackage names. That works and the play store launches.

Traceback (most recent call last):
  File "C:/Users/Kev/Documents/Projects/Appium/AppiumSandBox/Twitter_Android", line 9, in <module>
    driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)
  File "C:\Users\Kev\.virtualenvs\AppiumSandBox-g7D4ebOi\lib\site-packages\appium\webdriver\webdriver.py", line 147, in __init__
    super(WebDriver, self).__init__(
  File "C:\Users\Kev\.virtualenvs\AppiumSandBox-g7D4ebOi\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Kev\.virtualenvs\AppiumSandBox-g7D4ebOi\lib\site-packages\appium\webdriver\webdriver.py", line 227, in start_session
    response = self.execute(RemoteCommand.NEW_SESSION, parameters)
  File "C:\Users\Kev\.virtualenvs\AppiumSandBox-g7D4ebOi\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Kev\.virtualenvs\AppiumSandBox-g7D4ebOi\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.twitter.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 'C:\\Users\\Kev\\AppData\\Local\\AndroidSDK\\platform-tools\\adb.exe -P 5037 -s UEEDU18424003423 shell am start -W -n com.twitter.android/com.twitter.app.main.MainActivity -S' exited with code 255'; Stderr: 'Security exception: Permission Denial: starting Intent { flg=0x10000000 cmp=com.twitter.android/com.twitter.app.main.MainActivity } from null (pid=28751, uid=2000) not exported from uid 10349

java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.twitter.android/com.twitter.app.main.MainActivity } from null (pid=28751, uid=2000) not exported from uid 10349
    at com.android.server.am.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:2028)
    at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:923)
    at com.android.server.am.ActivityStarter.startActivity(ActivityStarter.java:656)
    at com.android.server.am.HwActivityStarter.startActivity(HwActivityStarter.java:222)
    at com.android.server.am.ActivityStarter.startActivityMayWait(ActivityStarter.java:1438)
    at com.android.server.am.HwActivityStarter.startActivityMayWait(HwActivityStarter.java:412)
    at com.android.server.am.ActivityStarter.execute(ActivityStarter.java:597)
    at com.android.server.am.ActivityManagerService.startActivityAndWait(ActivityManagerService.java:5901)
    at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:474)
    at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:161)
    at android.os.ShellCommand.exec(ShellCommand.java:103)
    at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:17744)
    at android.os.Binder.shellCommand(Binder.java:642)
    at android.os.Binder.onTransact(Binder.java:540)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3570)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3654)
    at com.android.server.am.HwActivityManagerService.onTransact(HwActivityManagerService.java:609)
    at android.os.Binder.execTransact(Binder.java:739)'; Code: '255'

Here is my script:

from appium import webdriver

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['deviceName'] = 'UEEDU18424003423'
desired_caps['appPackage'] = 'com.twitter.android'
desired_caps['appActivity'] = 'com.twitter.app.main.MainActivity'

driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)

Am I missing something?

1

I managed to fix it :)

The launchable activity was .StartActivity.

1
  • So would you say for future people having this issue... to just double check that their appActivity actually matches the activity they want to start? – corsiKa Mar 5 '20 at 5:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.