I am trying to connect android studio with appium in order to begin automation on mobile apps. These are my desired Capabilities below:
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '10'
desired_caps['deviceName'] = 'Samsung Galaxy s10+'
desired_caps['app'] = '/Users/sujithreddy/Downloads/Code2Lead/kwad.apk'
desired_caps['appPackage'] = 'com.code2lead.kwad'
desired_caps['appActivity'] = 'com.code2lead.kwad.MainActivity'
This the json Representation for APPIUM SERVER:
{
"appPackage": "com.code2lead.kwad",
"appActivity": "com.code2lead.kwad.MainActivity",
"platformName": "Android",
"deviceName": "Samsung Galaxy s10 plus",
"udid": "emulator-5554",
"automationName": "UiAutomator2"
}
I keep running into the error below and it will not connect the device thats being emulated to appium so I can begin finding locators and etc.
Calling AppiumDriver.createSession() with args: [{"appActivity":"com.code2lead.kwad.MainActivity","appPackage":"com.code2lead.kwad","automationName":"UiAutomator2","deviceName":"Samsung Galaxy s10 plus","ensureWebviewsHavePages":true,"platformName":"Android","skipServerInstallation":true,"udid":"emulator-5554","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1611095878280 (14:37:58 GMT-0800 (Pacific Standard Time))
[Appium] Appium v1.19.1 creating new AndroidUiautomator2Driver (v1.59.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] Creating session with MJSONWP desired capabilities: {
[BaseDriver] "appActivity": "com.code2lead.kwad.MainActivity",
[BaseDriver] "appPackage": "com.code2lead.kwad",
[BaseDriver] "automationName": "UiAutomator2",
[BaseDriver] "deviceName": "Samsung Galaxy s10 plus",
[BaseDriver] "ensureWebviewsHavePages": true,
[BaseDriver] "platformName": "Android",
[BaseDriver] "skipServerInstallation": true,
[BaseDriver] "udid": "emulator-5554",
[BaseDriver] "newCommandTimeout": 0,
[BaseDriver] "connectHardwareKeyboard": true
[BaseDriver] }
[BaseDriver] The following capabilities were provided, but are not recognized by Appium:
[BaseDriver] connectHardwareKeyboard
[BaseDriver] Session created with session id: b5225fde-8b15-480c-b657-ed9cae2b418f
[UiAutomator2] Starting 'com.code2lead.kwad' directly on the device
[ADB] Using 'adb' from '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb'
[ADB] Running '/Users/xvkayfej/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] Using device: emulator-5554
[ADB] Using 'adb' from '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb'
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 start-server'
[ADB] Setting device id to emulator-5554
[ADB] Running '/Users/xvkayfej/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': 29
[ADB] Getting device platform version
[ADB] Running '/Users/xvkayfej/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': 10
[ADB] Device API level: 29
[UiAutomator2] Relaxing hidden api policy
[ADB] Running '/Users/xvkayfej/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/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device'
[ADB] Running '/Users/xvkayfej/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/xvkayfej/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/xvkayfej/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.2.1' >= '3.2.1')
[ADB] There is no need to install/upgrade '/Applications/Appium.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/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[ADB] Running '/Users/xvkayfej/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/xvkayfej/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/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp:8200 tcp:6790'
[UiAutomator2] 'skipServerInstallation' is set. Skipping UIAutomator2 server installation.
[UiAutomator2] No app capability. Assuming it is already on the device
[ADB] Getting install status for com.code2lead.kwad
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package com.code2lead.kwad'
[ADB] 'com.code2lead.kwad' is installed
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.code2lead.kwad'
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm clear com.code2lead.kwad'
[AndroidDriver] Performed fast reset on the installed 'com.code2lead.kwad' application (stop and clear)
[UiAutomator2] Performing shallow cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (socket hang up)
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test'
[UiAutomator2] 'skipServerInstallation' is set. Attempting to use UIAutomator2 server from the device
[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","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[Instrumentation] INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner}
[Instrumentation] android.util.AndroidException: INSTRUMENTATION_FAILED: io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner
[Instrumentation] INSTRUMENTATION_STATUS: id=ActivityManagerService
[Instrumentation] at com.android.commands.am.Instrument.run(Instrument.java:514)
[Instrumentation] at com.android.commands.am.Am.runInstrument(Am.java:196)
[Instrumentation] INSTRUMENTATION_STATUS_CODE: -1
[Instrumentation] at com.android.commands.am.Am.onRun(Am.java:80)
[Instrumentation] at com.android.internal.os.BaseCommand.run(BaseCommand.java:56)
[Instrumentation] at com.android.commands.am.Am.main(Am.java:50)
[Instrumentation] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
[Instrumentation] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:338)
[Instrumentation] The process has exited with code 1
[UiAutomator2] The instrumentation process has been unexpectedly terminated. Retrying UiAutomator2 startup (#1 of 1)
[UiAutomator2] Performing strict cleanup of automation leftovers
[UiAutomator2] No obsolete sessions have been detected (socket hang up)
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test'
[ADB] Attempting to kill all uiautomator processes
[ADB] Getting IDs of all 'uiautomator' processes
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pgrep -f ([[:blank:]]|^)uiautomator([[:blank:]]|$)'
[ADB] No 'uiautomator' process has been found
[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","io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[Instrumentation] android.util.AndroidException: INSTRUMENTATION_FAILED: io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner
[Instrumentation] at com.android.commands.am.Instrument.run(Instrument.java:514)
[Instrumentation] at com.android.commands.am.Am.runInstrument(Am.java:196)
[Instrumentation] INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner}
[Instrumentation] INSTRUMENTATION_STATUS: id=ActivityManagerService
[Instrumentation] at com.android.commands.am.Am.onRun(Am.java:80)
[Instrumentation] at com.android.internal.os.BaseCommand.run(BaseCommand.java:56)
[Instrumentation] at com.android.commands.am.Am.main(Am.java:50)
[Instrumentation] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
[Instrumentation] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:338)
[Instrumentation] FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xdcf55000)
[Instrumentation] The process has exited with code 1
[UiAutomator2] The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop com.code2lead.kwad'
[Logcat] Stopping logcat capture
[ADB] Removing forwarded port socket connection: 8200
[ADB] Running '/Users/xvkayfej/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp:8200'
[UiAutomator2