How to extract android jetpack compose testTags in appium? - appium

My team is looking to do automated functional testing.
Once our developers started using jetpack compose, we lost most of our selectors.
I try to extract the testTags provided by compose.
here is th appium2 capabilities, built on the Raj Varlma's medium article - Automating Android Jetpack Compose using Appium using emulated pixel3A with api 30 in Appium Inspector :
{
"platformName": "Android",
"appium:app": "/Users/j.faux/Desktop/mobileApps/android/noFlippr.apk",
"appium:device": "emulator-5554",
"appium:platformVersion": "11",
"appium:automationName": "Espresso",
"appium:espressoBuildConfig": "{\"additionalAndroidTestDependencies\": [\"androidx.lifecycle:lifecycle-extensions:2.2.0\", \"androidx.activity:activity:1.3.1\", \"androidx.fragment:fragment:1.3.6\", \"androidx.activity:activity-compose:1.3.1\"]}",
"appium:skipUnlock": true,
"appium:fullReset": false,
"appium:forceEspressoRebuild": true,
"appium:showGradleLog": true
}
Here's a sample of the xml generated code from UIautomator2:
<androidx.compose.ui.platform.ComposeView index="0" package="sport.android.poufpouf.fr.qa" class="androidx.compose.ui.platform.ComposeView" text="" resource-id="sport.android.poufpouf.fr.qa:id/compose_view" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,124][1080,271]" displayed="true">
<android.view.View index="0" package="sport.android.poufpouf.fr.qa" class="android.view.View" text="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[0,124][1080,271]" displayed="true">
<android.view.View index="0" package="sport.android.poufpouf.fr.qa" class="android.view.View" text="" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" long-clickable="false" password="false" scrollable="false" selected="false" bounds="[552,134][678,260]" displayed="true">
I cannot run the apk running the above conf.
Espresso seems to achieve its build.
Here are appium logs
➜ ~ appium server -p 9000 -a 127.0.0.1 -pa /wd/hub
...
[debug] [ADB] Getting connected devices
[debug] [ADB] Connected devices: [{"udid":"emulator-5554","state":"device"}]
[AndroidDriver] Looking for a device with Android '11.0.0'
[ADB] Getting device platform version
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 11
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 start-server'
[debug] [ADB] Setting device id to emulator-5554
[BaseDriver] Using local app '/Users/j.faux/Desktop/mobileApps/android/appiumCompose/noFlippr2.apk'
[debug] [ADB] Checking app cert for /Users/j.faux/Desktop/mobileApps/android/appiumCompose/noFlippr2.apk
[ADB] Using 'apksigner.jar' from '/Users/j.faux/Library/Android/sdk/build-tools/33.0.1/lib/apksigner.jar'
[debug] [ADB] Starting apksigner: /Users/j.faux/homebrew/Cellar/openjdk\#11/11.0.17/libexec/openjdk.jdk/Contents/Home/bin/java -Xmx1024M -Xss1m -jar /Users/j.faux/Library/Android/sdk/build-tools/33.0.1/lib/apksigner.jar verify --print-certs /Users/j.faux/Desktop/mobileApps/android/appiumCompose/noFlippr2.apk
[debug] [ADB] apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android#android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[debug] [ADB] Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[debug] [ADB] Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[debug] [ADB] Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
[debug] [ADB]
[debug] [ADB] sha256 hash did match for 'noFlippr2.apk'
[ADB] '/Users/j.faux/Desktop/mobileApps/android/appiumCompose/noFlippr2.apk' is signed with the default certificate
[EspressoDriver#dbfa (c1141684)] EspressoDriver version: 2.13.8
[debug] [ADB] Current device property 'ro.build.version.sdk': 30
[ADB] Getting device platform version
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 11
[debug] [ADB] Device API level: 30
[debug] [ADB] Running '/Users/j.faux/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''
[ADB] Package name: 'sport.android.poufpouf.com.qa'
[ADB] Main activity name: 'reg.poufpouf.sport.features.splash.SplashActivity'
[debug] [AndroidDriver] Parsed package and activity are: sport.android.poufpouf.com.qa/reg.poufpouf.sport.features.splash.SplashActivity
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell echo ping'
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 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 '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 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 ('4.2.4' >= '4.2.4')
[debug] [ADB] There is no need to install/upgrade '/Users/j.faux/.appium/node_modules/appium-espresso-driver/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 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] [Logcat] Starting logs capture with command: /Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 logcat -v threadtime
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings get global animator_duration_scale'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings get global transition_animation_scale'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell settings get global window_animation_scale'
[debug] [EspressoDriver#dbfa (c1141684)] Forwarding Espresso Server port 6791 to 8300
[debug] [ADB] Forwarding system: 8300 to device: 6791
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward tcp:8300 tcp:6791'
[debug] [EspressoDriver#dbfa (c1141684)] 'skipUnlock' capability set, so skipping device unlock
[debug] [ADB] Getting install status for sport.android.poufpouf.com.qa
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package sport.android.poufpouf.com.qa'
[debug] [ADB] 'sport.android.poufpouf.com.qa' is installed
[debug] [ADB] Getting package info for 'sport.android.poufpouf.com.qa'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package sport.android.poufpouf.com.qa'
[debug] [ADB] The version name of the installed 'sport.android.poufpouf.com.qa' is greater or equal to the application version name ('6.0.5' >= '6.0.5')
[debug] [ADB] There is no need to install/upgrade '/Users/j.faux/Desktop/mobileApps/android/appiumCompose/noFlippr2.apk'
[AndroidDriver] Performing fast reset on 'sport.android.poufpouf.com.qa'
[debug] [ADB] Getting install status for sport.android.poufpouf.com.qa
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package sport.android.poufpouf.com.qa'
[debug] [ADB] 'sport.android.poufpouf.com.qa' is installed
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop sport.android.poufpouf.com.qa'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell pm clear sport.android.poufpouf.com.qa'
[debug] [AndroidDriver] Performed fast reset on the installed 'sport.android.poufpouf.com.qa' application (stop and clear)
[debug] [EspressoDriver#dbfa (c1141684)] 'forceEspressoRebuild' capability is enabled
[debug] [EspressoDriver#dbfa (c1141684)] Deleting the obsolete Espresso server package '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk'
[EspressoDriver#dbfa (c1141684)] Loading the build configuration from 'espressoBuildConfig' capability
[EspressoDriver#dbfa (c1141684)] Building espresso server in '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/espresso-server-emulator-5554'
[debug] [EspressoDriver#dbfa (c1141684)] The build folder root could be customized by changing the 'tmpDir' capability
[debug] [EspressoDriver#dbfa (c1141684)] Copying espresso server template from ('/Users/j.faux/.appium/node_modules/appium-espresso-driver/espresso-server' to '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/espresso-server-emulator-5554')
[debug] [Support] Traversed 52 directories and 281 files in 164ms
[debug] [EspressoDriver#dbfa (c1141684)] Bulding espresso server
[EspressoDriver#dbfa (c1141684)] Adding the following additionalAndroidTestDependencies to build.gradle.kts: androidTestImplementation("androidx.lifecycle:lifecycle-extensions:2.2.0"),androidTestImplementation("androidx.activity:activity:1.3.1"),androidTestImplementation("androidx.fragment:fragment:1.3.6"),androidTestImplementation("androidx.activity:activity-compose:1.3.1")
[debug] [EspressoDriver#dbfa (c1141684)] Beginning build with command '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/espresso-server-emulator-5554/gradlew -PappiumTargetPackage=sport.android.poufpouf.com.qa app:assembleAndroidTest' in directory '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/espresso-server-emulator-5554'
[debug] [EspressoDriver#dbfa (c1141684)] Output from Gradle will be logged. To change this, use 'showGradleLog' desired capability
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:preBuild UP-TO-DATE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:preDebugBuild UP-TO-DATE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugAidl NO-SOURCE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugRenderscript NO-SOURCE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:generateDebugBuildConfig FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:checkDebugAarMetadata FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:generateDebugResValues FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:generateDebugResources UP-TO-DATE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeDebugResources FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:createDebugCompatibleScreenManifests FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:extractDeepLinksDebug FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:processDebugMainManifest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:processDebugManifest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:processDebugManifestForPackage FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:processDebugResources FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugKotlin FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:javaPreCompileDebug FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugJavaWithJavac FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:bundleDebugClasses FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:preDebugAndroidTestBuild SKIPPED
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugAndroidTestAidl NO-SOURCE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:processDebugAndroidTestManifest
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:generateDebugAndroidTestBuildConfig FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:checkDebugAndroidTestAarMetadata FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugAndroidTestRenderscript NO-SOURCE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:generateDebugAndroidTestResValues FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:generateDebugAndroidTestResources UP-TO-DATE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeDebugAndroidTestResources FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:processDebugAndroidTestResources FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugAndroidTestKotlin FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:javaPreCompileDebugAndroidTest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugAndroidTestJavaWithJavac FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugAndroidTestSources UP-TO-DATE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeDebugAndroidTestShaders FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compileDebugAndroidTestShaders NO-SOURCE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:generateDebugAndroidTestAssets UP-TO-DATE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeDebugAndroidTestAssets FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:compressDebugAndroidTestAssets FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:processDebugAndroidTestJavaRes NO-SOURCE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeDebugAndroidTestJniLibFolders FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeDebugAndroidTestNativeLibs NO-SOURCE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:checkDebugAndroidTestDuplicateClasses FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:desugarDebugAndroidTestFileDependencies FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeExtDexDebugAndroidTest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeLibDexDebugAndroidTest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:dexBuilderDebugAndroidTest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeProjectDexDebugAndroidTest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:validateSigningDebugAndroidTest FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:writeDebugAndroidTestSigningConfigVersions FROM-CACHE
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:mergeDebugAndroidTestJavaResource
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:packageDebugAndroidTest
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:assembleDebugAndroidTest
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] > Task :app:assembleAndroidTest
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT]
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] BUILD SUCCESSFUL in 3s
[EspressoDriver#dbfa (c1141684)] [Gradle] [STDOUT] 37 actionable tasks: 3 executed, 34 from cache
[debug] [EspressoDriver#dbfa (c1141684)] Copying built apk from '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/espresso-server-emulator-5554/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk' to '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk'
[debug] [ADB] Checking app cert for /var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk
[debug] [ADB] Starting apksigner: /Users/j.faux/homebrew/Cellar/openjdk\#11/11.0.17/libexec/openjdk.jdk/Contents/Home/bin/java -Xmx1024M -Xss1m -jar /Users/j.faux/Library/Android/sdk/build-tools/33.0.1/lib/apksigner.jar verify --print-certs /var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk
[debug] [ADB] apksigner stdout: Signer #1 certificate DN: C=US, O=Android, CN=Android Debug
[debug] [ADB] Signer #1 certificate SHA-256 digest: 55634d7b56020fd4cd3c4d8d9191f62887748be325c4210d4911a957b6ae5e08
[debug] [ADB] Signer #1 certificate SHA-1 digest: b1d36cbdc548036ee0070a5a857f96fae6bcd58e
[debug] [ADB] Signer #1 certificate MD5 digest: 733bc344585729cdeac947b1753891ee
[debug] [ADB]
[ADB] '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk' is signed with a non-default certificate
[ADB] Using 'zipalign' from '/Users/j.faux/Library/Android/sdk/build-tools/33.0.1/zipalign'
[debug] [ADB] /var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk' is already zip-aligned. Doing nothing
[debug] [ADB] Signing '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk' with default cert
[debug] [ADB] Uninstalling io.appium.espressoserver.test
[debug] [ADB] Getting install status for io.appium.espressoserver.test
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.espressoserver.test'
[debug] [ADB] 'io.appium.espressoserver.test' is installed
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop io.appium.espressoserver.test'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 uninstall io.appium.espressoserver.test'
[debug] [ADB] 'adb uninstall io.appium.espressoserver.test' command output: Success
[ADB] io.appium.espressoserver.test was successfully uninstalled
[EspressoDriver#dbfa (c1141684)] Uninstalled the obsolete Espresso server package from the device under test
[debug] [ADB] Getting install status for io.appium.espressoserver.test
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.espressoserver.test'
[debug] [ADB] 'io.appium.espressoserver.test' is not installed
[debug] [ADB] App '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk' is not installed
[EspressoDriver#dbfa (c1141684)] Installing Espresso Test Server apk from the target device (path: '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk')
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 help'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 features'
[ADB] The application at '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk' will not be cached, because the device under test has confirmed the support of streamed installs
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 install /var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk'
[ADB] The installation of 'io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk' took 166ms
[debug] [ADB] Install command stdout: Serving...
[debug] [ADB] Performing Incremental Install
[debug] [ADB] Success
[debug] [ADB] Install command complete in 153 ms
[EspressoDriver#dbfa (c1141684)] Installed Espresso Test Server apk '/var/folders/zk/cnc6rrjd067dr2bjwx6s2y1w0000gp/T/io.appium.espressoserver.test_2.13.8_sport.android.poufpouf.com.qa_emulator-5554.apk' (pkg: 'io.appium.espressoserver.test')
[ADB] Adding packages ["io.appium.settings","io.appium.espressoserver.test"] to Doze whitelist
[debug] [ADB] Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.espressoserver.test",";"]]
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.espressoserver.test ;'
[debug] [EspressoDriver#dbfa (c1141684)] Performing cleanup of automation leftovers
[debug] [EspressoDriver#dbfa (c1141684)] No obsolete sessions have been detected (socket hang up)
[EspressoDriver#dbfa (c1141684)] Starting Espresso Server v2.13.8 with cmd: adb shell am instrument -w -e debug false -e disableAnalytics true io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner
[debug] [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","am","instrument","-w","-e","debug",false,"-e","disableAnalytics",true,"io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner"]
[EspressoDriver#dbfa (c1141684)] Waiting up to 45000ms for Espresso server to be online
[debug] [EspressoDriver#dbfa (c1141684)] Matched '/status' to command name 'getStatus'
[debug] [EspressoDriver#dbfa (c1141684)] Proxying [GET /status] to [GET http://127.0.0.1:8300/status] with no body
[EspressoDriver#dbfa (c1141684)] socket hang up
[debug] [EspressoDriver#dbfa (c1141684)] [Instrumentation] INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation ComponentInfo{io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner} from pid=21062, uid=21062 not allowed because package io.appium.espressoserver.test does not have a signature matching the target sport.android.poufpouf.com.qa
[debug] [EspressoDriver#dbfa (c1141684)] INSTRUMENTATION_STATUS: id=ActivityManagerService
[debug] [EspressoDriver#dbfa (c1141684)] INSTRUMENTATION_STATUS_CODE: -1
[debug] [EspressoDriver#dbfa (c1141684)] [Instrumentation] java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner} from pid=21062, uid=21062 not allowed because package io.appium.espressoserver.test does not have a signature matching the target sport.android.poufpouf.com.qa
[debug] [EspressoDriver#dbfa (c1141684)] [Instrumentation] at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
[debug] [EspressoDriver#dbfa (c1141684)] at android.os.Parcel.createException(Parcel.java:2357)
[debug] [EspressoDriver#dbfa (c1141684)] [Instrumentation] at android.os.Parcel.readException(Parcel.java:2340)
[debug] [EspressoDriver#dbfa (c1141684)] at android.os.Parcel.readException(Parcel.java:2282)
[debug] [EspressoDriver#dbfa (c1141684)] at android.app.IActivityManager$Stub$Proxy.startInstrumentation(IActivityManager.java:6090)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.commands.am.Instrument.run(Instrument.java:517)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.commands.am.Am.runInstrument(Am.java:202)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.commands.am.Am.onRun(Am.java:80)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.internal.os.BaseCommand.run(BaseCommand.java:60)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.commands.am.Am.main(Am.java:50)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
[debug] [EspressoDriver#dbfa (c1141684)] Caused by: android.os.RemoteException: Remote stack trace:
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.server.am.ActivityManagerService.startInstrumentation(ActivityManagerService.java:16921)
[debug] [EspressoDriver#dbfa (c1141684)] at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2655)
[debug] [EspressoDriver#dbfa (c1141684)] at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2883)
[debug] [EspressoDriver#dbfa (c1141684)] at android.os.Binder.execTransactInternal(Binder.java:1154)
[debug] [EspressoDriver#dbfa (c1141684)] at android.os.Binder.execTransact(Binder.java:1123)
[EspressoDriver#dbfa (c1141684)] Instrumentation process exited with code 1 from signal null
[EspressoDriver#dbfa (c1141684)] Espresso server process has been unexpectedly terminated. Check the Appium server log and the logcat output for more details
[debug] [EspressoDriver#dbfa (c1141684)] Deleting espresso session
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys activity services io.appium.settings/.recorder.RecorderService'
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop sport.android.poufpouf.com.qa'
[debug] [Logcat] Stopping logcat capture
[EspressoDriver#dbfa (c1141684)] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running '/Users/j.faux/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''
[debug] [ADB] Removing forwarded port socket connection: 8300
[debug] [ADB] Running '/Users/j.faux/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp:8300'
[debug] [AppiumDriver#f569] Event 'newSessionStarted' logged at 1672050778899 (11:32:58 GMT+0100 (Central European Standard Time))
[debug] [AppiumDriver#f569] Encountered internal error running command: A new session could not be created. Details: Espresso server process has been unexpectedly terminated. Check the Appium server log and the logcat output for more details. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.
[debug] [AppiumDriver#f569] Error: Espresso server process has been unexpectedly terminated. Check the Appium server log and the logcat output for more details. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.
[debug] [AppiumDriver#f569] at Object.errorAndThrow (/Users/j.faux/homebrew/lib/node_modules/appium/node_modules/#appium/support/lib/logging.js:115:34)
[debug] [AppiumDriver#f569] at condFn (/Users/j.faux/.appium/node_modules/appium-espresso-driver/lib/espresso-runner.js:287:20)
[debug] [AppiumDriver#f569] at spin (/Users/j.faux/.appium/node_modules/appium-espresso-driver/node_modules/asyncbox/lib/asyncbox.js:221:26)
[debug] [AppiumDriver#f569] at spin (/Users/j.faux/.appium/node_modules/appium-espresso-driver/node_modules/asyncbox/lib/asyncbox.js:231:20)
[debug] [AppiumDriver#f569] at waitForCondition (/Users/j.faux/.appium/node_modules/appium-espresso-driver/node_modules/asyncbox/lib/asyncbox.js:238:10)
[debug] [AppiumDriver#f569] at EspressoRunner.startSession (/Users/j.faux/.appium/node_modules/appium-espresso-driver/lib/espresso-runner.js:281:7)
[debug] [AppiumDriver#f569] at EspressoDriver.startEspressoSession (/Users/j.faux/.appium/node_modules/appium-espresso-driver/lib/driver.js:444:5)
[debug] [AppiumDriver#f569] at EspressoDriver.createSession (/Users/j.faux/.appium/node_modules/appium-espresso-driver/lib/driver.js:224:7)
[debug] [AppiumDriver#f569] at AppiumDriver.createSession (/Users/j.faux/homebrew/lib/node_modules/appium/lib/appium.js:336:35)
[HTTP] <-- POST /wd/hub/session 500 8111 ms - 1689
What am I missing ?

Related

Getting error as xcodebuild failed with code 65 Event 'wdaStartFailed'

Hi getting below error while running appium automation sript for ios device using xcode 14.I tried all th possible solutions but no luck so far.
As per below link there is a changes in xcode 14 which support only appium 2,but before trying appium 2 i wanted to confirm once whether this is the actual root cause or there is any other config issue https://forum.katalon.com/t/failed-to-build-webdriveragent-to-deployed-on-ios-16/78524
Below is the complete appium log
[info] [35m[Appium][39m Appium v1.22.0 creating new XCUITestDriver (v3.53.1) session
[info] [35m[Appium][39m Applying relaxed security to 'XCUITestDriver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure
[debug] [35m[BaseDriver][39m Creating session with W3C capabilities: {
[debug] [35m[BaseDriver][39m "alwaysMatch": {
[debug] [35m[BaseDriver][39m "platformName": "ios",
[debug] [35m[BaseDriver][39m "appium:VERSION": "15.6.1",
[debug] [35m[BaseDriver][39m "appium:automationName": "XCUITest",
[debug] [35m[BaseDriver][39m "appium:bundleId": "com.mobisy.bizom",
[debug] [35m[BaseDriver][39m "appium:deviceName": "Bizom Iphone",
[debug] [35m[BaseDriver][39m "appium:udid": "00008110-001475EE0C80401E",
[debug] [35m[BaseDriver][39m "appium:xcodeOrgId": "CM3KB1234",
[debug] [35m[BaseDriver][39m "appium:xcodeSigningId": "iPhone Developer"
[debug] [35m[BaseDriver][39m },
[debug] [35m[BaseDriver][39m "firstMatch": [
[debug] [35m[BaseDriver][39m {}
[debug] [35m[BaseDriver][39m ]
[debug] [35m[BaseDriver][39m }
[debug] [35m[WD Proxy][39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [35m[iProxy#00008110:8100][39m Connection was refused to port 8100
[info] [35m[WD Proxy][39m socket hang up[debug] [35m[WD Proxy][39m Matched '/status' to command name 'getStatus'
[debug] [35m[WD Proxy][39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [35m[iProxy#00008110:8100][39m Connection was refused to port 8100
[info] [35m[WD Proxy][39m socket hang up[error] [35m[WebDriverAgent][39m xcodebuild exited with code '65' and signal 'null'
[info] [35m[WebDriverAgent][39m Launching WebDriverAgent on the device
[info] [35m[WebDriverAgent][39m WebDriverAgent does not need a cleanup. The sources are up to date (1644399105000 >= 1632535255000)
[debug] [35m[WebDriverAgent][39m Killing running processes 'xcodebuild.*00008110-001475EE0C80401E' for the device 00008110-001475EE0C80401E...[debug] [35m[WebDriverAgent][39m 'pgrep -if xcodebuild.*00008110-001475EE0C80401E' didn't detect any matching processes. Return code: 1
[debug] [35m[WebDriverAgent][39m Using Xcode configuration file: '/var/folders/nt/rb3yh81n7m543x9rl4996v7c0000gp/T/202303-842-1lzs80g.e5g4/appium-temp.xcconfig'
[debug] [35m[WebDriverAgent][39m Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/divya.p/Library/Developer/Xcode/DerivedData/WebDriverAgent-aghlrsejdreqngftgvcqwnjgrbou -destination id=00008110-001475EE0C80401E IPHONEOS_DEPLOYMENT_TARGET=15.6 -xcconfig /var/folders/nt/rb3yh81n7m543x9rl4996v7c0000gp/T/202303-842-1lzs80g.e5g4/appium-temp.xcconfig GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Applications/Appium Server GUI.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent'
[debug] [35m[WebDriverAgent][39m Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability[debug] [35m[WD Proxy][39m Matched '/status' to command name 'getStatus'
[info] [35m[WD Proxy][39m socket hang up[debug] [35m[WD Proxy][39m Matched '/status' to command name 'getStatus'
[debug] [35m[WD Proxy][39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body[debug] [35m[WD Proxy][39m Matched '/status' to command name 'getStatus'
[debug] [35m[WD Proxy][39m Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[debug] [35m[iProxy#00008110:8100][39m Connection was refused to port 8100
[info] [35m[WD Proxy][39m socket hang up
[error] [35m[WebDriverAgent][39m xcodebuild exited with code '65' and signal 'null'
[debug] [35m[BaseDriver][39m Event 'wdaStartFailed' logged at 1672738945363 (15:12:25 GMT+0530 (India Standard Time))
[debug] [35m[XCUITest][39m Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
[debug] [35m[XCUITest][39m xcodebuild error message:
[debug] [35m[XCUITest][39m . Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[warn] [35m[XCUITest][39m Quitting and uninstalling WebDriverAgent
[info] [35m[WebDriverAgent][39m Shutting down sub-processes[debug] [35m[WebDriverAgent][39m Uninstalling WDAs: 'com.mobisy.bizom.xctrunner'[error] [35m[XCUITest][39m {}
[info] [35m[DevCon Factory][39m Releasing connections for 00008110-001475EE0C80401E device on any port number
[info] [35m[DevCon Factory][39m Found cached connections to release: ["00008110-001475EE0C80401E:8100"]
[info] [35m[DevCon Factory][39m Releasing the listener for '00008110-001475EE0C80401E:8100'
[debug] [35m[iProxy#00008110:8100][39m Closing the connection
[debug] [35m[DevCon Factory][39m Cached connections count: 0
[debug] [35m[XCUITest][39m Not clearing log files. Use `clearSystemFiles` capability to turn on.
[info] [35m[iProxy#00008110:8100][39m The connection has been closed

Could not acquire lock on uia2_device_port_guard. File already exists

I am new in Appium. I run my app from last 3 weeks by using this code. suddenly when I run this from another class it shows this error in appium server. I do know why it's occurring. I run it in the morning.
public class BaseClass {
public AndroidDriver<AndroidElement> driver;
#BeforeClass
public AndroidDriver<AndroidElement> capabilities() throws MalformedURLException{
File appDir = new File("src/test/resources");
File app = new File(appDir, "KandareeLiteApp.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "100");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability("appPackage", "bd.com.cslsoft.kandareeliteapp");
capabilities.setCapability("appActivity","bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity");
driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.resetApp();
}
Here is the Appium server-side code-- when start [Logcat] it take so much time.
[W3C] Calling AppiumDriver.createSession() with args: [{"app":"D:\\Automation Project\\Resources\\KandareeLiteApp\\src\\test\\resources\\KandareeLiteApp.apk","appActivity":"bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity","appPackage":"bd.com.cslsoft.kandareeliteapp","newCommandTimeout":"100","platformName":"Android","deviceName":"emulator-5554"},null,{"firstMatch":[{"appium:app":"D:\\Automation Project\\Resources\\KandareeLiteApp\\src\\test\\resources\\KandareeLiteApp.apk","appium:appActivity":"bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity","appium:appPackage":"bd.com.cslsoft.kandareeliteapp","appium:deviceName":"emulator-5554","appium:newCommandTimeout":"100","platformName":"android"}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1606228007305 (20:26:47 GMT+0600 (Bangladesh Standard Time))
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[Appium]
[Appium] ======================================================================
[Appium] DEPRECATION WARNING:
[Appium]
[Appium] The 'automationName' capability was not provided in the desired
[Appium] capabilities for this Android session
[Appium]
[Appium] Setting 'automationName=UiAutomator2' by default and using the
[Appium] UiAutomator2 Driver
[Appium]
[Appium] The next major version of Appium (2.x) will **require** the
[Appium] 'automationName' capability to be set for all sessions on all
[Appium] platforms
[Appium]
[Appium] In previous versions (Appium <= 1.13.x), the default was
[Appium] 'automationName=UiAutomator1'
[Appium]
[Appium] If you wish to use that automation instead of UiAutomator2, please
[Appium] add 'automationName=UiAutomator1' to your desired capabilities
[Appium]
[Appium] For more information about drivers, please visit
[Appium] http://appium.io/docs/en/about-appium/intro/ and explore the
[Appium] 'Drivers' menu
[Appium]
[Appium] ======================================================================
[Appium]
[Appium] Appium v1.18.3 creating new AndroidUiautomator2Driver (v1.56.1) 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:app": "D:\\Automation Project\\Resources\\KandareeLiteApp\\src\\test\\resources\\KandareeLiteApp.apk",
[BaseDriver] "appium:appActivity": "bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity",
[BaseDriver] "appium:appPackage": "bd.com.cslsoft.kandareeliteapp",
[BaseDriver] "appium:deviceName": "emulator-5554",
[BaseDriver] "appium:newCommandTimeout": "100"
[BaseDriver] },
[BaseDriver] "firstMatch": [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[BaseDriver] Capability 'newCommandTimeout' changed from string ('100') to integer (100). This may cause unexpected behavior
[BaseDriver] Session created with session id: 9ff2777d-7fcd-4a7e-8e9d-02b3eed680f0
[BaseDriver] Using local app 'D:\Automation Project\Resources\KandareeLiteApp\src\test\resources\KandareeLiteApp.apk'
[UiAutomator2] Checking whether app is actually present
[ADB] Using 'adb.exe' from 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -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.exe' from 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 start-server'
[ADB] Setting device id to emulator-5554
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -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 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -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 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -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''
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 wait-for-device'
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -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 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -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.0' >= '3.2.0')
[ADB] There is no need to install/upgrade 'D:\New folder\Appium-windows-1.18.3\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 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pgrep -f io\\.appium\\.settings'
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[Logcat] Starting logs capture with command: C:\\Users\\syedyunus\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s emulator-5554 logcat -v threadtime
[UiAutomator2] Deleting UiAutomator2 session
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop bd.com.cslsoft.kandareeliteapp'
[Logcat] Stopping logcat capture
[UiAutomator2] Restoring hidden api policy to the device default configuration
[ADB] Running 'C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -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 1606228129127 (20:28:49 GMT+0600 (Bangladesh Standard Time))
[W3C] Encountered internal error running command: Error: Could not acquire lock on C:\Users\SYEDYU~1\AppData\Local\Temp\uia2_device_port_guard. Original error: Error: EEXIST: file already exists, open 'C:\Users\SYEDYU~1\AppData\Local\Temp\uia2_device_port_guard'
[W3C] at guard (D:\New folder\Appium-windows- 1.18.3\resources\app\node_modules\appium\node_modules\appium-support\lib\util.js:477:13)
[W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 121825 ms - 1023
You can Manually delete the file uia2_device_port_guard from given location, Then run.
It worked for me as well.
Go to: C:\Users\(username)\AppData\Local\Temp\
Find: uia2_device_port_guard file
Delete it
Restart Appium server
Please delete the uia2_device_port_guard file it will work normally.
If you don't know the path then follow steps as below,
Open run window(Ctrl+R)
Type temp and click on OK
Select all and clear all the temps files.
Again write %temp% in open field and click on OK
Select all and clear all the temps files
uia2_device_port_guard file will delete automatically
After deleting the both the temp files, refresh and reopen. It will work fine.
As i did exactly the same and it started working normally.
For Mac users:
Open Terminal
Go to /var/folders/92/hbvgxyp96p3f5vxzgsf1thh80000gp/T
Delete file uia2_device_port_guard
Command:
rm uia2_device_port_guard

Appium-unhandled exception ENOENT is occuring

Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"C:/Users/yjaya/Desktop/app-release-unsigned.apk","platformName":"Android","deviceName":"Nexus","platformVersion":"6.0"}},{"requiredCapabilities":{}}],"desiredCapabilities":{"app":"C:/Users/yjaya/Desktop/app-release-unsigned.apk","platformName":"Android","deviceName":"Nexus","platformVersion":"6.0"},"requiredCapabilities":{}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_131)
info: [debug] No appActivity desired capability or server param. Parsing from apk.
info: [debug] No appPackage desired capability or server param. Parsing from apk.
info: [debug] Using local app from desired caps: C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] Creating new appium session f7d1277d-e625-4bc1-a4ad-4902bb5ed25b
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_131
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe dump badging C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] badging package: com.indsci.iassign
info: [debug] badging act: com.indsci.iassign.HomeActivity
info: [debug] Parsed package and activity are: com.indsci.iassign/com.indsci.iassign.HomeActivity
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 23
info: Device API level is: 23
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language:
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\yjaya\Desktop\app-release-unsigned.apk" "C:\Users\yjaya\AppData\Local\Temp;C:\Program Files\Java\jre1.8.0_121\bin\com.indsci.iassign"
info: [debug] No strings.xml for language '', getting default strings.xml
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\yjaya\Desktop\app-release-unsigned.apk" "C:\Users\yjaya\AppData\Local\Temp;C:\Program Files\Java\jre1.8.0_121\bin\com.indsci.iassign"
warn: Error getting strings.xml from apk
info: [debug] Exception in thread "main" java.lang.Exception: Output is not an existing readable directory.
at io.appium.apktools.StringsXML.e(StringsXML.java:112)
at io.appium.apktools.Main.main(Main.java:23)
warn: Could not get strings, continuing anyway
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell "echo '{}' > /data/local/tmp/strings.json"
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\aapt.exe dump xmltree C:\Users\yjaya\Desktop\app-release-unsigned.apk AndroidManifest.xml
info: [debug] Set app process to: com.indsci.iassign
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\yjaya\Desktop\app-release-unsigned.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\yjaya\Desktop\app-release-unsigned.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users\yjaya\AppData\Local\Android\sdk\build-tools\25.0.3\zipalign.exe
> error: Unhandled error: Error: ENOENT, no such file or directory 'C:\Users\yjaya\AppData\Local\Temp;C:\ProgramFiles\Java\jre1.8.0_121\bin\117522-13276-xudx2z'
at Error (native)
at Object.fs.mkdirSync (fs.js:747:18)
at tempDir (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\node_modules\appium-support\lib\tempdir.js:21:8)
at Object.generateName [as path] (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\node_modules\appium-support\lib\tempdir.js:29:20)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:460:30)
at [object Object].ADB.checkSdkBinaryPresent (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:116:5)
at [object Object].ADB.checkZipAlignPresent (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:146:8)
at [object Object].ADB.zipAlignApk (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:457:8)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:496:10)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5) context: [POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"C:/Users/yjaya/Desktop/app-release-unsigned.apk","platformName":"Android","deviceName":"Nexus","platformVersion":"6.0"}},{"requiredCapabilities":{}}],"d]
Also have done adding Environment variables with sdk path..Still getting the above error.
Can anyone please help me on this.

Unable to install an App using Appium

I'm trying to setup and run Appium. I've downloaded all that is needed to run it.
Here is the output for Appium-doctor just to prove that:
info AppiumDoctor Appium Doctor v.1.4.2
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor ✔ Node version is 5.0.0
info AppiumDoctor ✔ ANDROID_HOME is set to: /Users/shasharma/Library/Android/sdk
info AppiumDoctor ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home
info AppiumDoctor ✔ adb exists at: /Users/shasharma/Library/Android/sdk/platform-tools/adb
info AppiumDoctor ✔ android exists at: /Users/shasharma/Library/Android/sdk/tools/android
info AppiumDoctor ✔ emulator exists at: /Users/shasharma/Library/Android/sdk/tools/emulator
info AppiumDoctor ✔ Bin directory of $JAVA_HOME is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor
The code I'm trying to run:
package com.groupon;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
public class ApplicationEndTest {
#SuppressWarnings("rawtypes")
private static AndroidDriver driver;
#SuppressWarnings("rawtypes")
public static void main(String[] args) throws MalformedURLException, InterruptedException {
File app = new File("//Users//shasharma//Documents//workspace//CMPE287TeamProject2Appium//groupon.apk");
System.out.println(app.getAbsolutePath());
DesiredCapabilities capabilities = new DesiredCapabilities();
//capabilities.setCapability(MobileCapabilityType.APPIUM_VERSION, "1.6.4");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.1.1");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
//capabilities.setCapability(MobileCapabilityType., "com.groupon");
//capabilities.setCapability("appActivity", value);
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
//capabilities.setCapability(MobileCapabilityType., value);
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
Thread.sleep(10000);
driver.quit();
}
}
When I run this code, this is the error that I keep on getting. I've scoured the internet to find a result but I'm not sure what I'm missing.
The server is running
Start New SessionStop Server
[Appium] Welcome to Appium v1.6.4
[Appium] Non-default server args:
[Appium] address: 127.0.0.1
[Appium] sessionOverride: true
[Appium] Appium REST http interface listener started on 127.0.0.1:4723
[HTTP] --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"}},{"requiredCapabilities":{}}],"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},"requiredCapabilities":{}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},{},[{"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"}},{"requiredCapabilities":{}}],null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1493086147232 (19:09:07 GMT-0700 (PDT))
[Appium] Creating new AndroidDriver (v1.17.1) session
[Appium] Capabilities:
[Appium] app: '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[Appium] platformName: 'Android'
[Appium] deviceName: 'emulator-5554'
[Appium] appiumVersion: '1.6.4'
[Appium] platformVersion: '7.1.1'
[AndroidDriver] AndroidDriver version: 1.17.1
[BaseDriver] The following capabilities were provided, but are not recognized by appium: appiumVersion.
[BaseDriver] Session created with session id: c3f0b693-2e57-4e40-ad24-84e0c51d1c5a
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_73
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '7.1.1'
[ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[AndroidDriver] Using device: emulator-5554
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[ADB] Setting device id to emulator-5554
[BaseDriver] Using local app '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[AndroidDriver] Checking whether app is actually present
[AndroidDriver] Starting Android session
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
[Logcat] Starting logcat capture
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","io.appium.settings"]
[ADB] App is installed
[ADB] Getting package info for io.appium.settings
[ADB] Getting connected devices...
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Cannot read version codes of /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/app/build/outputs/apk/settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","dump","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[AndroidDriver] Pushing unlock helper app to device...
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Application '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk' already installed. Continuing.
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","appops","set","io.appium.settings","android:mock_location","allow"]
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","wm","size"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.model"]
[ADB] Current device property 'ro.product.model': Android SDK built for x86
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.manufacturer"]
[ADB] Current device property 'ro.product.manufacturer': unknown
[AndroidDriver] Parsing package and activity from app manifest
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Extracting package and launch activity from manifest
[ADB] Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[MJSONWP] Encountered internal error running command: Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[HTTP] <-- POST /wd/hub/session 500 3500 ms - 234
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},"requiredCapabilities":{}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"},{},null,null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1493086150750 (19:09:10 GMT-0700 (PDT))
[Appium] Creating new AndroidDriver (v1.17.1) session
[Appium] Capabilities:
[Appium] app: '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[Appium] platformName: 'Android'
[Appium] deviceName: 'emulator-5554'
[Appium] appiumVersion: '1.6.4'
[Appium] platformVersion: '7.1.1'
[AndroidDriver] AndroidDriver version: 1.17.1
[BaseDriver] The following capabilities were provided, but are not recognized by appium: appiumVersion.
[BaseDriver] Session created with session id: a078f599-9622-437f-b437-dfa5a25d7610
[AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_73
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[AndroidDriver] Looking for a device with Android '7.1.1'
[ADB] Setting device id to emulator-5554
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[AndroidDriver] Using device: emulator-5554
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/shasharma/Library/Android/sdk/platform-tools/adb
[ADB] Setting device id to emulator-5554
[BaseDriver] Using local app '/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk'
[AndroidDriver] Checking whether app is actually present
[AndroidDriver] Starting Android session
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","wait-for-device"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","echo","ping"]
[Logcat] Starting logcat capture
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","list","packages","io.appium.settings"]
[ADB] App is installed
[ADB] Getting package info for io.appium.settings
[ADB] Getting connected devices...
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Cannot read version codes of /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/io.appium.settings/app/build/outputs/apk/settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.sdk"]
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","dumpsys","package","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","dump","io.appium.settings"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","pm","grant","io.appium.settings","android.permission.WRITE_SETTINGS",";","pm","grant","io.appium.settings","android.permission.ACCESS_MOCK_LOCATION",";"]
[AndroidDriver] Pushing unlock helper app to device...
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","install","/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[ADB] Application '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk' already installed. Continuing.
[ADB] Device API level: 25
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","appops","set","io.appium.settings","android:mock_location","allow"]
[ADB] Getting device platform version
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.build.version.release"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","wm","size"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.model"]
[ADB] Current device property 'ro.product.model': Android SDK built for x86
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","getprop","ro.product.manufacturer"]
[ADB] Current device property 'ro.product.manufacturer': unknown
[AndroidDriver] Parsing package and activity from app manifest
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/shasharma/Library/Android/sdk/build-tools/25.0.2/aapt
[ADB] Extracting package and launch activity from manifest
[ADB] Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[AndroidDriver] Shutting down Android driver
[AndroidDriver] Called deleteSession but bootstrap wasn't active
[Logcat] Stopping logcat capture
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running '/Users/shasharma/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","emulator-5554","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[MJSONWP] Encountered internal error running command: Error: packageAndLaunchActivityFromManifest failed. Original error: Path must be a string. Received null
at Object.wrappedLogger.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:63:13)
at ADB.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/tools/android-manifest.js:88:9)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 2980 ms - 234
[HTTP] --> POST /wd/hub/session {"capabilities":[{"desiredCapabilities":{"app":"/Users/shasharma/Documents/workspace/CMPE287TeamProject2Appium/groupon.apk","platformName":"Android","deviceName":"emulator-5554","appiumVersion":"1.6.4","platformVersion":"7.1.1"}},{"requiredCapabilities":{}}]}
[MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","capabilities","sessionId","id"]} and you sent ["capabilities"]
[HTTP] <-- POST /wd/hub/session 400 1 ms - 171
I believe the following line might be your problem:
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");
"emulator-5554" is the generic name it gives whatever the currently running device, I believe. You should pass the literal name you called the device (emulator) when you created it. In my apps, I use:
String deviceName = "Nexus 6P API 23";
Then I just pass deviceName as the parameter. As always, your mileage may vary.

Appium : UiAutomator quit before it successfully launched

Launching Appium server with command: C:\Program Files (x86)\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --platform-name Android --platform-version 23 --automation-name Appium --log-no-color
info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"23","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.Honkampkrueger.hk","appActivity":".MainActivity","app":"C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk","browserName":"","platformName":"Android","deviceName":"Android Emulator","version":"4.4.2"}}
info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_71)
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : version
info: [debug] Using local app from desired caps: C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk
info: [debug] Creating new appium session f2eb01fe-7b8c-4e7c-89c6-5d776471a569
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_71
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Program Files\SDK\platform-tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 wait-for-device
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] Extracting strings for language: default
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "getprop persist.sys.language"
info: [debug] Current device persist.sys.language: en
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk" "C:\Users\KULDEE~1.SAH\AppData\Local\Temp\com.Honkampkrueger.hk" en
info: [debug] No strings.xml for language 'en', getting default strings.xml
info: [debug] java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk" "C:\Users\KULDEE~1.SAH\AppData\Local\Temp\com.Honkampkrueger.hk"
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 push "C:\Users\KULDEE~1.SAH\AppData\Local\Temp\com.Honkampkrueger.hk\strings.json" /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Program Files\SDK\build-tools\23.0.2\aapt.exe
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: "C:\Program Files\SDK\build-tools\23.0.2\aapt.exe" dump xmltree C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk AndroidManifest.xml
info: [debug] Set app process to: com.Honkampkrueger.hk
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk.
info: [debug] executing cmd: java -jar "C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Program Files\SDK\build-tools\23.0.2\zipalign.exe
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: "C:\Program Files\SDK\build-tools\23.0.2\zipalign.exe" -f 4 C:\Users\kuldeep.sahu\workspace\AppiumIntro\Src\honkamp.apk C:\Users\KULDEE~1.SAH\AppData\Local\Temp\11615-3480-14zot2k\appium.tmp
info: [debug] MD5 for app is 91f72bc7e64a758cdb9d0b8414bd853c
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/91f72bc7e64a758cdb9d0b8414bd853c.apk"
info: [debug] Getting install status for com.Honkampkrueger.hk
info: [debug] Getting device API level
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 com.Honkampkrueger.hk"
info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "mkdir -p /data/local/tmp/"
info: [debug] Removing any old apks
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/*.apk"
info: [debug] Found an apk we want to keep at /data/local/tmp/91f72bc7e64a758cdb9d0b8414bd853c.apk
info: [debug] Couldn't find any apks to remove
info: [debug] Uninstalling com.Honkampkrueger.hk
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "am force-stop com.Honkampkrueger.hk"
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 uninstall com.Honkampkrueger.hk
info: [debug] App was not uninstalled, maybe it wasn't on device?
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "pm install -r /data/local/tmp/91f72bc7e64a758cdb9d0b8414bd853c.apk"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\Program Files\SDK\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.Honkampkrueger.hk -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.NullPointerException
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: longMsg=null
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_CODE: 0
info: [debug] UiAutomator exited
info: [debug] executing cmd: "C:\Program Files\SDK\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ping'"
info: [debug] Attempting to uninstall app
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: UiAutomator quit before it successfully launched
error: Failed to start an Appium session, err was: Error: UiAutomator quit before it successfully launched
info: [debug] Error: UiAutomator quit before it successfully launched
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:205:23)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-hybrid.js:249:5)
at Object.async.eachSeries (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:142:20)
at [object Object].androidHybrid.stopChromedriverProxies (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-hybrid.js:233:9)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:200:10)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:222:9)
at [object Object].androidCommon.uninstallApp (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:478:5)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:220:12)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js:229:11)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:901:7
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:180:9)
at ChildProcess.exithandler (child_process.js:742:7)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1016:16)
at Process.ChildProcess._handle.onexit (child_process.js:1088:5)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: UiAutomator quit before it successfully launched)","origValue":"UiAutomator quit before it successfully launched"},"sessionId":null}
info: <-- POST /wd/hub/session 500 46111.400 ms - 218
Error : Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: UiAutomator quit before it successfully launched) (WARNING: The server did not provide any stacktrace information).
Anyone have solution of this as My running emulator is very slow to launch.
UiAutomator quit before it successfully launched error: Failed to
start an Appium session, err was: Error: UiAutomator quit before it
successfully launched info: [debug] Error: UiAutomator quit before it
successfully launched at [object Object]. (C:\Program Files
(x86)\Appium\node_modules\appium\lib\devices\android\android.js:205:23)
at [object Object].
These suggests that UIAutomator did not launch due to which Appium session was not created. [SessionNotCreatedException on your IDE]
Restarting adb server and appium serve shall help you.
Prior to that you can also try running the UIAutomator using shell to verify if its working alright on your machine.
In case you using Appium 1.4 + version to automate android (7.0 / N / Nougat ) version, this issue persists. you have to make couple of changes to get this working properly.
We had a similar issue, when we started to automate a simple mobile application using appium, android studio and selenium webdriver, after so many searches and also looking at various appium support tickets, we found that it was a bug and they have given an alternative to fix and go ahead.
You have to change code in couple of places in following file:
C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js
Those details have been listed in below article:
http://www.testingtools.co/appium/error-command-failed-adb-exe-s-emulator-5554-shell-ps-uiautomator
Hope it helps you, in case you have any queries, you can post them over the blog article in form of comments as well.
You cannot run UIAutomator and Appium server in parallel, this is known issue. Make sure your Appium server is stopped before you run your UIAutomator then try again. This should work.

Resources