Appium Inspector - Failed to create session. An unknown server-side error occurred while processing the command. Original error: Cannot start the application

I have set the desired capabilities like this
{
“appium:automationName”: “uiautomator2”,
“appium:platformVersion”: “11”,
“appium:deviceName”: “emulator-5554”,
“platformName”: “Android”,
“appium:appPackage”: “com.saucelabs.mydemoapp.rn”
}

And pop up the error message

========
Failed to create session. An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘com.saucelabs.mydemoapp.rn’ 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/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -W -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000’ exited with code 1’; Stderr: ‘Error: Intent matches multiple activities; can’t stop: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 }’; Code: ‘1’

Can any one help please? thank you

appium version is 2.0.0 beta.55

server log in below:

The server is running
[-h-t-t-p] Waiting until the server is closed
[-h-t-t-p] Received server close event
[Appium] Welcome to Appium v1.22.0
[Appium] Non-default server args:
[Appium] relaxedSecurityEnabled: true
[Appium] allowInsecure: {
[Appium] }
[Appium] denyInsecure: {
[Appium] }
[Appium] Appium REST -h-t-t-p interface listener started on 0.0.0.0:4723
[-h-t-t-p] --> POST /wd/hub/session
[-h-t-t-p] {“capabilities”:{“alwaysMatch”:{“appium:automationName”:“uiautomator2”,“appium:platformVersion”:“11”,“appium:deviceName”:“emulator-5554”,“platformName”:“Android”,“appium:appPackage”:“com.saucelabs.mydemoapp.rn”,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,“appium:newCommandTimeout”:3600,“appium:connectHardwareKeyboard”:true},“firstMatch”:[{}]},“desiredCapabilities”:{“appium:automationName”:“uiautomator2”,“appium:platformVersion”:“11”,“appium:deviceName”:“emulator-5554”,“platformName”:“Android”,“appium:appPackage”:“com.saucelabs.mydemoapp.rn”,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,“appium:newCommandTimeout”:3600,“appium:connectHardwareKeyboard”:true}}
[W3C] Calling AppiumDriver.createSession() with args: [{“appium:automationName”:“uiautomator2”,“appium:platformVersion”:“11”,“appium:deviceName”:“emulator-5554”,“platformName”:“Android”,“appium:appPackage”:“com.saucelabs.mydemoapp.rn”,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,“appium:newCommandTimeout”:3600,“appium:connectHardwareKeyboard”:true},null,{“alwaysMatch”:{“appium:automationName”:“uiautomator2”,“appium:platformVersion”:“11”,“appium:deviceName”:“emulator-5554”,“platformName”:“Android”,“appium:appPackage”:“com.saucelabs.mydemoapp.rn”,“appium:ensureWebviewsHavePages”:true,“appium:nativeWebScreenshot”:true,“appium:newCommandTimeout”:3600,“appium:connectHardwareKeyboard”:true},“firstMatch”:[{}]}]
[BaseDriver] Event ‘newSessionRequested’ logged at 1676740295521 (01:11:35 GMT+0800 (Hong Kong Standard Time))
[Appium] Appium v1.22.0 creating new AndroidUiautomator2Driver (v1.69.0) session
[Appium] Applying relaxed security to ‘AndroidUiautomator2Driver’ as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver] “alwaysMatch”: {
[BaseDriver] “platformName”: “Android”,
[BaseDriver] “appium:automationName”: “uiautomator2”,
[BaseDriver] “appium:platformVersion”: “11”,
[BaseDriver] “appium:deviceName”: “emulator-5554”,
[BaseDriver] “appium:appPackage”: “com.saucelabs.mydemoapp.rn”,
[BaseDriver] “appium:ensureWebviewsHavePages”: true,
[BaseDriver] “appium:nativeWebScreenshot”: true,
[BaseDriver] “appium:newCommandTimeout”: 3600,
[BaseDriver] “appium:connectHardwareKeyboard”: true
[BaseDriver] },
[BaseDriver] “firstMatch”: [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] connectHardwareKeyboard
[BaseDriver] Session created with session id: 590fae57-654d-4c05-9ace-d2db1aa93408
[UiAutomator2] Starting ‘com.saucelabs.mydemoapp.rn’ directly on the device
[ADB] Using ‘adb’ from ‘/Users/raymond/Library/Android/sdk/platform-tools/adb’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 start-server’
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices
[ADB] Connected devices: [{“udid”:“emulator-5554”,“state”:“device”}]
[AndroidDriver] Looking for a device with Android ‘11.0.0’
[ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release’
[ADB] Current device property ‘ro.build.version.release’: 11
[AndroidDriver] Using device: emulator-5554
[ADB] Using ‘adb’ from ‘/Users/raymond/Library/Android/sdk/platform-tools/adb’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 start-server’
[ADB] Setting device id to emulator-5554
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk’
[ADB] Current device property ‘ro.build.version.sdk’: 30
[ADB] Getting device platform version
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release’
[ADB] Current device property ‘ro.build.version.release’: 11
[ADB] Device API level: 30
[UiAutomator2] Relaxing hidden api policy
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell ‘settings put global hidden_api_policy_pre_p_apps 1;settings put global hidden_api_policy_p_apps 1;settings put global hidden_api_policy 1’’
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell echo ping’
[AndroidDriver] Pushing settings apk to device…
[ADB] Getting install status for io.appium.settings
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings’
[ADB] ‘io.appium.settings’ is installed
[ADB] Getting package info for ‘io.appium.settings’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings’
[ADB] The version name of the installed ‘io.appium.settings’ is greater or equal to the application version name (‘3.4.0’ >= ‘3.4.0’)
[ADB] There is no need to install/upgrade ‘/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/apks/settings_apk-debug.apk’
[ADB] Getting IDs of all ‘io.appium.settings’ processes
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell ‘pgrep --help; echo $?’’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[Logcat] Starting logs capture with command: /Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 logcat -v threadtime
[UiAutomator2] Forwarding UiAutomator2 Server port 6790 to local port 8200
[ADB] Forwarding system: 8200 to device: 6790
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp:8200 tcp:6790’
[ADB] Getting install status for io.appium.uiautomator2.server
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server’
[ADB] ‘io.appium.uiautomator2.server’ is installed
[ADB] Getting package info for ‘io.appium.uiautomator2.server’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server’
[ADB] The version name of the installed ‘io.appium.uiautomator2.server’ is greater or equal to the application version name (‘4.24.0’ >= ‘4.24.0’)
[UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
[ADB] Checking app cert for /Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v4.24.0.apk
[ADB] Using the previously cached signature entry for ‘appium-uiautomator2-server-v4.24.0.apk’
[ADB] sha256 hash did match for ‘appium-uiautomator2-server-v4.24.0.apk’
[ADB] Getting install status for io.appium.uiautomator2.server.test
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.uiautomator2.server.test’
[ADB] ‘io.appium.uiautomator2.server.test’ is installed
[ADB] Checking app cert for /Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk
[ADB] Using the previously cached signature entry for ‘appium-uiautomator2-server-debug-androidTest.apk’
[ADB] sha256 hash did match for ‘appium-uiautomator2-server-debug-androidTest.apk’
[UiAutomator2] Server packages are not going to be (re)installed
[UiAutomator2] Waiting up to 30000ms for services to be available
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm list instrumentation’
[UiAutomator2] Instrumentation target ‘io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner’ is available
[ADB] Adding packages [“io.appium.settings”,“io.appium.uiautomator2.server”,“io.appium.uiautomator2.server.test”] to Doze whitelist
[ADB] Got the following command chunks to execute: [[“dumpsys”,“deviceidle”,“whitelist”,"+io.appium.settings",";",“dumpsys”,“deviceidle”,“whitelist”,"+io.appium.uiautomator2.server",";",“dumpsys”,“deviceidle”,“whitelist”,"+io.appium.uiautomator2.server.test",";"]]
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;’
[UiAutomator2] No app capability. Assuming it is already on the device
[ADB] Getting install status for com.saucelabs.mydemoapp.rn
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package com.saucelabs.mydemoapp.rn’
[ADB] ‘com.saucelabs.mydemoapp.rn’ is installed
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.saucelabs.mydemoapp.rn’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm clear com.saucelabs.mydemoapp.rn’
[AndroidDriver] Performed fast reset on the installed ‘com.saucelabs.mydemoapp.rn’ application (stop and clear)
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (socket hang up)
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test’
[UiAutomator2] Starting UIAutomator2 server 4.24.0
[UiAutomator2] Using UIAutomator2 server from ‘/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v4.24.0.apk’ and test from ‘/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk’
[UiAutomator2] Waiting up to 30000ms for UiAutomator2 to be online…
[ADB] Creating ADB subprocess with args: ["-P",5037,"-s",“emulator-5554”,“shell”,“am”,“instrument”,"-w","-e",“disableAnalytics”,true,“io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner”]
[WD Proxy] Matched ‘/status’ to command name ‘getStatus’
[WD Proxy] Proxying [GET /status] to [GET -h-t-t-p://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] socket hang up
[Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
[WD Proxy] Matched ‘/status’ to command name ‘getStatus’
[WD Proxy] Proxying [GET /status] to [GET -h-t-t-p://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] socket hang up
[WD Proxy] Matched ‘/status’ to command name ‘getStatus’
[WD Proxy] Proxying [GET /status] to [GET -h-t-t-p://127.0.0.1:8200/wd/hub/status] with no body
[WD Proxy] Got response with status 200: {“sessionId”:“None”,“value”:{“message”:“UiAutomator2 Server is ready to accept commands”,“ready”:true}}
[UiAutomator2] The initialization of the instrumentation process took 2073ms
[WD Proxy] Matched ‘/session’ to command name ‘createSession’
[WD Proxy] Proxying [POST /session] to [POST -h-t-t-p://127.0.0.1:8200/wd/hub/session] with body: {“capabilities”:{“firstMatch”:[{“platform”:“LINUX”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“platformName”:“Android”,“automationName”:“uiautomator2”,“platformVersion”:“11”,“deviceName”:“emulator-5554”,“appPackage”:“com.saucelabs.mydemoapp.rn”,“ensureWebviewsHavePages”:true,“nativeWebScreenshot”:true,“newCommandTimeout”:3600,“connectHardwareKeyboard”:true},“platformName”:“Android”,“automationName”:“uiautomator2”,“platformVersion”:“11”,“deviceName”:“emulator-5554”,“appPackage”:“com.saucelabs.mydemoapp.rn”,“ensureWebviewsHavePages”:true,“nativeWebScreenshot”:true,“newCommandTimeout”:3600,“connectHardwareKeyboard”:true,“deviceUDID”:“emulator-5554”}],“alwaysMatch”:{}}}
[WD Proxy] Got response with status 200: {“sessionId”:“a54312bc-3e52-4289-b525-0b69b0865e69”,“value”:{“capabilities”:{“firstMatch”:[{“platform”:“LINUX”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“platformName”:“Android”,“automationName”:“uiautomator2”,“platformVersion”:“11”,“deviceName”:“emulator-5554”,“appPackage”:“com.saucelabs.mydemoapp.rn”,“ensureWebviewsHavePages”:true,“nativeWebScreenshot”:true,“newCommandTimeout”:3600,“connectHardwareKeyboard”:true},“platformName”:“Android”,“automationName”:“uiautomator2”,“platformVersion”:“11”,“deviceName”:“emulator-5554”,“appPackage”:“com.saucelabs.mydemoapp.rn”,“ensureWebviewsHavePages”:true,“nativeWebScreenshot”:true,“newCommandTimeout”:3600,“connectHardwareKeyboard”:true,“deviceUDID”:“emulator-5554”}],“alwaysMatch”:{}},“sessionId”:“a54312bc-3e52-4289-b525-0b69b0865e69”}}
[WD Proxy] Determined the downstream protocol as ‘W3C’
[WD Proxy] Proxying [GET /appium/device/info] to [GET -h-t-t-p://127.0.0.1:8200/wd/hub/session/a54312bc-3e52-4289-b525-0b69b0865e69/appium/device/info] with no body
[WD Proxy] Got response with status 200: {“sessionId”:“a54312bc-3e52-4289-b525-0b69b0865e69”,“value”:{“androidId”:“70b0c6c2db0b977e”,“apiVersion”:“30”,“bluetooth”:{“state”:“ON”},“brand”:“google”,“carrierName”:“Android”,“displayDensity”:440,“locale”:“en_US”,“manufacturer”:“Google”,“model”:“sdk_gphone_arm64”,“networks”:[{“capabilities”:{“SSID”:null,“linkDownBandwidthKbps”:30000,“linkUpstreamBandwidthKbps”:15000,“networkCapabilities”:“NET_CAPABILITY_MMS,NET_CAPABILITY_SUPL,NET_CAPABILITY_DUN,NET_CAPABILITY_FOTA,NET_CAPABILITY_IMS,NET_CAPABILITY_CBS,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_VALIDATED,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED”,“signalStrength”:-2147483648,“transportTypes”:“TRANSPORT_CELLULAR”},“detailedState”:“CONNECTED”,“extraInfo”:“epc.tmobile.com”,“isAvailable”:true,“isConnected”:true,“isFailover”:false,“isRoaming”:false,“state”:“CONNECTED”,“subtype”:13,“subtypeName”:“LTE”,“type”:0,“typeName”:“MOBILE”},{“capabilities”…
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys window’
[AndroidDriver] Screen already unlocked, doing nothing
[UiAutomator2] Starting 'com.saucelabs.mydemoapp.rn/null and waiting for ‘com.saucelabs.mydemoapp.rn/null’
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -W -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000’
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched ‘/’ to command name ‘deleteSession’
[WD Proxy] Proxying [DELETE /] to [DELETE -h-t-t-p://127.0.0.1:8200/wd/hub/session/a54312bc-3e52-4289-b525-0b69b0865e69] with no body
[WD Proxy] Got response with status 200: {“sessionId”:“a54312bc-3e52-4289-b525-0b69b0865e69”,“value”:null}
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.saucelabs.mydemoapp.rn’
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp:8200’
[UiAutomator2] Restoring hidden api policy to the device default configuration
[ADB] Running ‘/Users/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell ‘settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy’’
[BaseDriver] Event ‘newSessionStarted’ logged at 1676740299447 (01:11:39 GMT+0800 (Hong Kong Standard Time))
[W3C] Encountered internal error running command: Error: Cannot start the ‘com.saucelabs.mydemoapp.rn’ application. Visit -h-t-t-ps://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/raymond/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -W -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000’ exited with code 1’; Stderr: ‘Error: Intent matches multiple activities; can’t stop: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 }’; Code: ‘1’
[W3C] at ADB.startApp (/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/apk-utils.js:179:11)
[-h-t-t-p] <-- POST /wd/hub/session 500 3937 ms - 1845
[-h-t-t-p]
[Instrumentation] .
[Instrumentation] Time: 2.17
[Instrumentation]
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0

According to this document you need capability:

‘appium:appWaitActivity’: ‘com.saucelabs.mydemoapp.rn.MainActivity’

Might take a look at the others too just in case you need them. They do specify the app capability. More good info here:

Thank you sir. it is working now after added “appium:appActivity” “com.saucelabs.mydemoapp.rn.MainActivity”

Actually I am beginner on Appium server and Inspector. I have just used the example from internet and try it out. Still need to learn how to find Element and writing scripting. Anyway thank you so much.

1 Like

@wreed I think, I have the same problem

Failed to create session. An unknown server-side error occurred while processing the command. Original error: Either provide ‘app’ option to install ‘com.android.calculator2’ or consider setting ‘noReset’ to ‘true’ if ‘com.android.calculator2’ is supposed to be preinstalled.

Here is the error message, I tried to inspect Calculator.

{
“platformName”: “Android”,
“appium:platformVersion”: “13.0”,
“appium:deviceName”: “emulator-5554”,
“appium:automationName”: “UiAutomator2”,
“appium:appPackage”: “com.android.calculator2”,
“appium:appActivity”: “.Calculator”
}

This is my caps, and my appium version is

Appium -v
2.0.0-rc.4

Can you help me?

What happens if you follow the instructions in the error? Or is it not clear? These options go in capabilities. Probably can just add “noReset”: true to what you already have.

OK, I follow the instructions in the error.
This is the new error

Failed to create session. An unknown server-side error occurred while processing the command. Original error: Cannot start the ‘com.android.calculator2’ application. Consider checking the driver’s troubleshooting documentation. Original error: Cannot start the ‘com.android.calculator2’ application. Consider checking the driver’s troubleshooting documentation. Original error: Activity name ‘.com.android.calculator2.Calculator’ used to start the app doesn’t exist or cannot be launched! Make sure it exists and is a launchable activity

Here is the updated caps after saving it

{
“platformName”: “Android”,
“appium:platformVersion”: “13.0”,
“appium:deviceName”: “emulator-5554”,
“appium:automationName”: “UiAutomator2”,
“appium:appPackage”: “com.android.calculator2”,
“appium:appActivity”: “com.android.calculator2.Calculator”,
“appium:noReset”: true
}

I’ve seen a couple of these types of errors with Android 13. I’m not sure why that happens. Since it’s just an emulator can you try Android 12?

Also, how are you starting Appium server?

1 Like

yes, for android 12 and 11 it was working very fine. getting appActivity issue with android 13.

1 Like

Now, I am trying android 12 but the same error.

For the second question, I am starting Appium server from command line by writing appium just like that and hit enter.

Every thing works fine when I start Appium with installing the app to phone but when want to inspect an app already on the phone or built in android app like calculator give the above error.

I will try android 11 and tell you what happened.

Here is also a screenshot:

add “/wd/hub” in remote path. then, start session.

this will work.

not working although I tried that.

@wreed
When I download ApiDemos-debug.apk from Appium repository to my project and also add it to my emulator as application every thing works fine but when I comment this line

//caps.setCapability("app", System.getProperty("user.dir") + "/apps/ApiDemos-debug.apk");

and add these two lines

caps.setCapability(“appPackage”, “io.appium.android.apis”);
caps.setCapability(“appActivity”, “.ApiDemos”);

Everything works fine, I don’t know why this is not working for calculator app?

Here is the full code:
public class FirstAndroidTest {

AppiumDriver driver;
public static String URL = "http://localhost:4723/";


@BeforeTest
public void setUp() throws URISyntaxException, MalformedURLException {
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("platformName", "Android");
    caps.setCapability("automationName", "UiAutomator2");
    caps.setCapability("deviceName", "emulator-5554");
    caps.setCapability("platformVersion", "12.0");
    //caps.setCapability("app", System.getProperty("user.dir") + "/apps/ApiDemos-debug.apk");
    caps.setCapability("appPackage", "io.appium.android.apis");
    caps.setCapability("appActivity", ".ApiDemos");
    caps.setCapability("noReset", true);
    driver = new AndroidDriver(new URI(URL).toURL(), caps);
}

@Test
public void click_App_Button() throws InterruptedException {
    //driver.findElement(By.xpath("//android.widget.TextView[@content-desc=\"App\"]")).click();
    Thread.sleep(5000);
}

@AfterTest
public void tearDown() {
    if (null != driver) {
        driver.quit();
    }
}

Could you tell my why?

Apparently it’s a new security feature in Android 13. I hope this helps:

https://stackoverflow.com/questions/73495596/unable-to-launch-arbitrary-activity-since-android-13

1 Like