Appium not start app or closed after open

Hi,
I use appium 1.22 with real android device.
When I start the connection I am facing this error below, after this the appium log.

    Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.itau.empresas' 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\\qa.itau\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s RX8T4044PSA shell am start -W -n com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability
    Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
    System info: host: 'SMBH-020878', ip: '10.100.9.32', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
    Driver info: driver.version: AndroidDriver
    remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.itau.empresas' 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\\qa.itau\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s RX8T4044PSA shell am start -W -n com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability
        at getResponseForW3CError (C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
        at asyncHandler (C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:380:37)
    Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
    System info: host: 'SMBH-020878', ip: '10.100.9.32', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.12'
    Driver info: driver.version: AndroidDriver
    [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 75.56 s <<< FAILURE! - in br.com.test.integration.android.empresa.wifi.AndroidEmpresaPj6Test
    [ERROR] br.com.test.integration.android.empresa.wifi.AndroidEmpresaPj6Test  Time elapsed: 75.558 s  <<< ERROR!
    java.lang.NullPointerException
    	at br.com.test.integration.android.empresa.wifi.AndroidEmpresaPj6Test.inicializar(AndroidEmpresaPj6Test.java:53)

APPIUM LOG:

  [HTTP] --> POST /wd/hub/session
  [HTTP] {"desiredCapabilities":{"appPackage":"com.itau.empresas","simpleIsVisibleCheck":true,"noReset":true,"deviceName":"CHROME_EMPRESA_PJ36","fullReset":false,"appActivity":"com.itau.empresas.feature.login.DashboardLogin","newCommandTimeout":"1200","automationName":"uiautomator2","platformName":"Android","udid":"RQ8T700804A","ignoreHiddenApiPolicyError":true,"systemPort":8280},"capabilities":{"firstMatch":[{"appium:appActivity":"com.itau.empresas.feature.login.DashboardLogin","appium:appPackage":"com.itau.empresas","appium:automationName":"uiautomator2","appium:deviceName":"CHROME_EMPRESA_PJ36","appium:fullReset":false,"ignoreHiddenApiPolicyError":true,"appium:newCommandTimeout":"1200","appium:noReset":true,"platformName":"android","appium:simpleIsVisibleCheck":true,"appium:systemPort":8280,"appium:udid":"RQ8T700804A"}]}}
  [debug] [W3C] Calling AppiumDriver.createSession() with args: [{"appPackage":"com.itau.empresas","simpleIsVisibleCheck":true,"noReset":true,"deviceName":"CHROME_EMPRESA_PJ36","fullReset":false,"appActivity":"com.itau.empresas.feature.login.DashboardLogin","newCommandTimeout":"1200","automationName":"uiautomator2","platformName":"Android","udid":"RQ8T700804A","ignoreHiddenApiPolicyError":true,"systemPort":8280},null,{"firstMatch":[{"appium:appActivity":"com.itau.empresas.feature.login.DashboardLogin","appium:appPackage":"com.itau.empresas","appium:automationName":"uiautomator2","appium:deviceName":"CHROME_EMPRESA_PJ36","appium:fullReset":false,"ignoreHiddenApiPolicyError":true,"appium:newCommandTimeout":"1200","appium:noReset":true,"platformName":"android","appium:simpleIsVisibleCheck":true,"appium:systemPort":8280,"appium:udid":"RQ8T700804A"}]}]
  [debug] [BaseDriver] Event 'newSessionRequested' logged at 1673977575878 (14:46:15 GMT-0300 (Horário Padrão de Brasília))
  [BaseDriver] The following capabilities are not standard capabilities and should have an extension prefix:
  [BaseDriver]   ignoreHiddenApiPolicyError
  [BaseDriver] Number capability passed in as string. Functionality may be compromised.
  [Appium] Appium v1.22.3 creating new AndroidUiautomator2Driver (v1.70.1) session
  [debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
  [debug] [BaseDriver] Creating session with W3C capabilities: {
  [debug] [BaseDriver]   "alwaysMatch": {
  [debug] [BaseDriver]     "appium:ignoreHiddenApiPolicyError": true,
  [debug] [BaseDriver]     "platformName": "android",
  [debug] [BaseDriver]     "appium:appActivity": "com.itau.empresas.feature.login.DashboardLogin",
  [debug] [BaseDriver]     "appium:appPackage": "com.itau.empresas",
  [debug] [BaseDriver]     "appium:automationName": "uiautomator2",
  [debug] [BaseDriver]     "appium:deviceName": "CHROME_EMPRESA_PJ36",
  [debug] [BaseDriver]     "appium:fullReset": false,
  [debug] [BaseDriver]     "appium:newCommandTimeout": "1200",
  [debug] [BaseDriver]     "appium:noReset": true,
  [debug] [BaseDriver]     "appium:simpleIsVisibleCheck": true,
  [debug] [BaseDriver]     "appium:systemPort": 8280,
  [debug] [BaseDriver]     "appium:udid": "RQ8T700804A"
  [debug] [BaseDriver]   },
  [debug] [BaseDriver]   "firstMatch": [
  [debug] [BaseDriver]     {}
  [debug] [BaseDriver]   ]
  [debug] [BaseDriver] }
  [BaseDriver] Number capability passed in as string. Functionality may be compromised.
  [BaseDriver] Capability 'newCommandTimeout' changed from string ('1200') to integer (1200). This may cause unexpected behavior
  [BaseDriver] The following capabilities were provided, but are not recognized by Appium:
  [BaseDriver]   simpleIsVisibleCheck
  [BaseDriver] Session created with session id: adad562c-bd08-42fc-ab4a-434c9297fe18
  [UiAutomator2] Starting 'com.itau.empresas' directly on the device
  [ADB] Using 'adb.exe' from 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe'
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 start-server'
  [AndroidDriver] Retrieving device list
  [debug] [ADB] Trying to find a connected android device
  [debug] [ADB] Getting connected devices
  [debug] [ADB] Connected devices: [{"udid":"RQ8T505X8HD","state":"device"},{"udid":"RQ8T505XBYA","state":"device"},{"udid":"RQ8T505Z28K","state":"device"},{"udid":"RQ8T700804A","state":"device"},{"udid":"RQ8T70088HL","state":"device"},{"udid":"RQ8T7008F4M","state":"device"},{"udid":"RQ8T7008KDZ","state":"device"},{"udid":"RX8N107HZKX","state":"device"},{"udid":"RX8T5088YKJ","state":"device"},{"udid":"RX8T509MLLK","state":"device"},{"udid":"RX8T509MPWK","state":"device"},{"udid":"RX8T50FSTZM","state":"device"},{"udid":"RX8T50GG3QN","state":"device"},{"udid":"RX8T50GG72M","state":"device"}]
  [AndroidDriver] Using device: RQ8T700804A
  [ADB] Using 'adb.exe' from 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe'
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 start-server'
  [debug] [ADB] Setting device id to RQ8T700804A
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell getprop ro.build.version.sdk'
  [debug] [ADB] Current device property 'ro.build.version.sdk': 33
  [ADB] Getting device platform version
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell getprop ro.build.version.release'
  [debug] [ADB] Current device property 'ro.build.version.release': 13
  [debug] [ADB] Device API level: 33
  [UiAutomator2] Relaxing hidden api policy
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A 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
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A wait-for-device'
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell echo ping'
  [debug] [AndroidDriver] Pushing settings apk to device...
  [debug] [ADB] Getting install status for io.appium.settings
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell dumpsys package io.appium.settings'
  [debug] [ADB] 'io.appium.settings' is installed
  [debug] [ADB] Getting package info for 'io.appium.settings'
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell dumpsys package io.appium.settings'
  [debug] [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')
  [debug] [ADB] There is no need to install/upgrade 'C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk'
  [debug] [ADB] Getting IDs of all 'io.appium.settings' processes
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell 'pgrep --help; echo $?''
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell pgrep -f \(\[\[:blank:\]\]\|\^\)io\.appium\.settings\(\[\[:blank:\]\]\|\$\)'
  [debug] [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell appops set io.appium.settings android:mock_location allow'
  [debug] [Logcat] Starting logs capture with command: C:\\Users\\qa.itau\\AppData\\Local\\Android\\platform-tools\\adb.exe -P 5037 -s RQ8T700804A logcat -v threadtime
  [debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to local port 8280
  [debug] [ADB] Forwarding system: 8280 to device: 6790
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A forward tcp:8280 tcp:6790'
  [debug] [ADB] Getting install status for io.appium.uiautomator2.server
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell dumpsys package io.appium.uiautomator2.server'
  [debug] [ADB] 'io.appium.uiautomator2.server' is installed
  [debug] [ADB] Getting package info for 'io.appium.uiautomator2.server'
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell dumpsys package io.appium.uiautomator2.server'
  [debug] [ADB] The version name of the installed 'io.appium.uiautomator2.server' is greater or equal to the application version name ('4.27.0' >= '4.27.0')
  [debug] [UiAutomator2] io.appium.uiautomator2.server installation state: sameVersionInstalled
  [debug] [ADB] Checking app cert for C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.27.0.apk
  [debug] [ADB] Using the previously cached signature entry for 'appium-uiautomator2-server-v4.27.0.apk'
  [debug] [ADB] sha256 hash did match for 'appium-uiautomator2-server-v4.27.0.apk'
  [debug] [ADB] Getting install status for io.appium.uiautomator2.server.test
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell dumpsys package io.appium.uiautomator2.server.test'
  [debug] [ADB] 'io.appium.uiautomator2.server.test' is installed
  [debug] [ADB] Checking app cert for C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
  [debug] [ADB] Using the previously cached signature entry for 'appium-uiautomator2-server-debug-androidTest.apk'
  [debug] [ADB] sha256 hash did match for 'appium-uiautomator2-server-debug-androidTest.apk'
  [UiAutomator2] Server packages are not going to be (re)installed
  [debug] [UiAutomator2] Waiting up to 30000ms for services to be available
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell pm list instrumentation'
  [debug] [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
  [debug] [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",";"]]
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;'
  [debug] [UiAutomator2] No app capability. Assuming it is already on the device
  [debug] [UiAutomator2] Performing shallow cleanup of automation leftovers
  [debug] [UiAutomator2] No obsolete sessions have been detected (socket hang up)
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell am force-stop io.appium.uiautomator2.server.test'
  [UiAutomator2] Starting UIAutomator2 server 4.27.0
  [UiAutomator2] Using UIAutomator2 server from 'C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.27.0.apk' and test from 'C:\Users\qa.itau\AppData\Roaming\npm\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...
  [debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","RQ8T700804A","shell","am","instrument","-w","-e","disableAnalytics",true,"io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
  [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
  [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8280/wd/hub/status] with no body
  [WD Proxy] socket hang up
  [debug] [Instrumentation] io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:
  [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
  [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8280/wd/hub/status] with no body
  [WD Proxy] socket hang up
  [debug] [WD Proxy] Matched '/status' to command name 'getStatus'
  [debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8280/wd/hub/status] with no body
  [debug] [WD Proxy] Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
  [debug] [UiAutomator2] The initialization of the instrumentation process took 2352ms
  [debug] [WD Proxy] Matched '/session' to command name 'createSession'
  [debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8280/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","ignoreHiddenApiPolicyError":true,"appActivity":"com.itau.empresas.feature.login.DashboardLogin","appPackage":"com.itau.empresas","automationName":"uiautomator2","deviceName":"CHROME_EMPRESA_PJ36","fullReset":false,"newCommandTimeout":1200,"noReset":true,"simpleIsVisibleCheck":true,"systemPort":8280,"udid":"RQ8T700804A"},"platformName":"android","ignoreHiddenApiPolicyError":true,"appActivity":"com.itau.empresas.feature.login.DashboardLogin","appPackage":"com.itau.empresas","automationName":"uiautomator2","deviceName":"RQ8T700804A","fullReset":false,"newCommandTimeout":1200,"noReset":true,"simpleIsVisibleCheck":true,"systemPort":8280,"udid":"RQ8T700804A","deviceUDID":"RQ8T700804A"}],"alwaysMatch":{}}}
  [debug] [WD Proxy] Got response with status 200: {"sessionId":"43a82c10-d99a-4168-9167-7daa802e837e","value":{"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformName":"android","ignoreHiddenApiPolicyError":true,"appActivity":"com.itau.empresas.feature.login.DashboardLogin","appPackage":"com.itau.empresas","automationName":"uiautomator2","deviceName":"CHROME_EMPRESA_PJ36","fullReset":false,"newCommandTimeout":1200,"noReset":true,"simpleIsVisibleCheck":true,"systemPort":8280,"udid":"RQ8T700804A"},"platformName":"android","ignoreHiddenApiPolicyError":true,"appActivity":"com.itau.empresas.feature.login.DashboardLogin","appPackage":"com.itau.empresas","automationName":"uiautomator2","deviceName":"RQ8T700804A","fullReset":false,"newCommandTimeout":1200,"noReset":true,"simpleIsVisibleCheck":true,"systemPort":8280,"udid":"RQ8T700804A","deviceUDID":"RQ8T700804A"}],"alwaysM...
  [WD Proxy] Determined the downstream protocol as 'W3C'
  [debug] [WD Proxy] Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8280/wd/hub/session/43a82c10-d99a-4168-9167-7daa802e837e/appium/device/info] with no body
  [debug] [WD Proxy] Got response with status 200: {"sessionId":"43a82c10-d99a-4168-9167-7daa802e837e","value":{"androidId":"30310590de00f57b","apiVersion":"33","bluetooth":{"state":"OFF"},"brand":"samsung","carrierName":"","displayDensity":420,"locale":"pt_BR","manufacturer":"samsung","model":"SM-A525M","networks":[{"capabilities":{"SSID":null,"linkDownBandwidthKbps":48160,"linkUpstreamBandwidthKbps":3996,"networkCapabilities":"NET_CAPABILITY_NOT_METERED,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_VALIDATED,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_FOREGROUND,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED","signalStrength":-38,"transportTypes":"TRANSPORT_WIFI"},"detailedState":"CONNECTED","extraInfo":"","isAvailable":true,"isConnected":true,"isFailover":false,"isRoaming":false,"state":"CONNECTED","subtype":-1,"subtypeName":"","type":1,"typeName":"WIFI"}],"platformVersion":"13","realDisplaySize":"1080x2400","timeZone":"America/Sao_Paulo"}}
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell dumpsys window'
  [AndroidDriver] Screen already unlocked, doing nothing
  [UiAutomator2] Starting 'com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin and waiting for 'com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin'
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell am start -W -n com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000'
  [debug] [UiAutomator2] Deleting UiAutomator2 session
  [debug] [UiAutomator2] Deleting UiAutomator2 server session
  [debug] [WD Proxy] Matched '/' to command name 'deleteSession'
  [debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8280/wd/hub/session/43a82c10-d99a-4168-9167-7daa802e837e] with no body
  [debug] [WD Proxy] Got response with status 200: {"sessionId":"43a82c10-d99a-4168-9167-7daa802e837e","value":null}
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell am force-stop com.itau.empresas'
  [debug] [Instrumentation] .
  [debug] [Instrumentation]
  [debug] [Instrumentation] Time: 51,122
  [debug] [Instrumentation]
  [debug] [Instrumentation] OK (1 test)
  [debug] [Instrumentation] The process has exited with code 0
  [debug] [Logcat] Stopping logcat capture
  [debug] [ADB] Removing forwarded port socket connection: 8280
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A forward --remove tcp:8280'
  [UiAutomator2] Restoring hidden api policy to the device default configuration
  [debug] [ADB] Running 'C:\Users\qa.itau\AppData\Local\Android\platform-tools\adb.exe -P 5037 -s RQ8T700804A shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''
  [debug] [BaseDriver] Event 'newSessionStarted' logged at 1673977647122 (14:47:27 GMT-0300 (Horário Padrão de Brasília))
  [debug] [W3C] Encountered internal error running command: Error: Cannot start the 'com.itau.empresas' 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\\qa.itau\\AppData\\Local\\Android\\platform-tools\\adb.exe -P 5037 -s RQ8T700804A shell am start -W -n com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability
  [debug] [W3C]     at ADB.startApp (C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:179:11)
  [debug] [W3C]     at AndroidUiautomator2Driver.ensureAppStarts (C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:564:7)
  [debug] [W3C]     at AndroidUiautomator2Driver.startUiAutomator2Session (C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:431:7)
  [debug] [W3C]     at AndroidUiautomator2Driver.createSession (C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-driver\lib\driver.js:229:7)
  [debug] [W3C]     at AppiumDriver.createSession (C:\Users\qa.itau\AppData\Roaming\npm\node_modules\appium\lib\appium.js:387:35)
  [HTTP] <-- POST /wd/hub/session 500 71688 ms - 1849
  [HTTP]

https://github.com/appium/appium/issues/17594 :slight_smile:

I understand that this link thread is about the best way to start and close the app. In my case, I launch the app and after a few seconds the app closes by itself and I can’t navigate the app.

no. the link is about that Appium 2.0 did not close android app after test, while with Appium 1.X did it.
now we have same capability for android as for iOS to restart app before test.
appium:forceAppLaunch

aaaa. I misread your problem! sorry.

  1. try command manually
C:\\Users\\qa.itau\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s RX8T4044PSA shell am start -W -n com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000

// or shorter version
adb -P 5037 -s RX8T4044PSA shell am start -W -n com.itau.empresas/com.itau.empresas.feature.login.DashboardLogin
  1. also try open android studio -> open logcat logs -> start app manually. check what activity it starts and compare what wrong in command above.

Thank you very much for clarifying the subject of the link.

About my problem:

  1. I don’t have access to the development apk. We are conducting black box testing. I only have access to the Appium console.

  2. If I use the variables in capabilities, the application closes by itself.

    appium:appPackage
    appium:appActivity

  3. If I don’t use the variables and on the device’s home screen I click on the icon to open the app, it works normally and the app doesn’t close by itself.

log appium:

[debug] [BaseDriver] Creating session with W3C resources: {
[debug] [BaseDriver] “alwaysMatch”: {
[debug] [BaseDriver] “appium:ignoreHiddenApiPolicyError”: true,
[debug] [BaseDriver] “platformName”: “android”,
[debug] [BaseDriver] “appium:appActivity”: “com.app.feature.login”,
[debug] [BaseDriver] “appium:appPackage”: “com.app”,
[debug] [BaseDriver] “appium:automationName”: “uiautomator2”,
[debug] [BaseDriver] “appium:deviceName”: “Name_Device”,
[debug] [BaseDriver] “appium: fullReset”: false,
[debug] [BaseDriver] “appium:newCommandTimeout”: “1200”,
[debug] [BaseDriver] “appium:noReset”: true,
[debug] [BaseDriver] “appium:simpleIsVisibleCheck”: true,
[debug] [BaseDriver] “appium:systemPort”: 8280,
[debug] [BaseDriver] “appium:udid”: “RQ8T700804A”
[debug] [BaseDriver] },
[debug] [BaseDriver] “firstMatch”: [
[debug][BaseDriver]{}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }

It just possible you start not correct activity.