Hi,
I currently have a test script running on a real Android device but would like to run it on an emulator instead. I have been trying to do this for weeks but just can’t get Appium to run on an emulator. When I launch Appium, the application installs in the emulator but Appium stops after a while. The error shown in the log is:
error: Could not pre-launch appium: Error: com.mnx.TestID.mobile.android/.TestID never started. Current: com.mnx.TestID.mobile.android/.core.TestIDApplication$LanguageSelectionViewController
I have also attached my complete log below. Any help would be greatly appreciated. Thanks!
Launching Appium with command: export ANDROID_HOME=“/usr/local/Cellar/android-sdk/24.4.1/”; ‘/Applications/Appium.app/Contents/Resources/node/bin/node’ lib/server/main.js --address “127.0.0.1” --command-timeout “7200” --session-override --pre-launch --debug-log-spacing --automation-name “Appium” --platform-name “Android” --platform-version “6.0” --app “/Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk” --dont-stop-app-on-reset --avd “test” --device-name “emulator-5554”
info: [debug] Starting Appium in pre-launch mode
info: Pre-launching app
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
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 command line: /Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk
info: [debug] Creating new appium session ae277103-07ea-4163-8f32-88b676cd1f21
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_45
info: [debug] Checking whether adb is present
info: [debug] Using adb from /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from /usr/local/Cellar/android-sdk/24.4.1/build-tools/23.0.2/aapt
info: [debug] Extracting package and launch activity from manifest.
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/build-tools/23.0.2/aapt dump badging /Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk
info: [debug] badging package: com.mnx.TestID.mobile.android
info: [debug] badging act: com.mnx.TestID.mobile.android.TestID
info: [debug] Parsed package and activity are: com.mnx.TestID.mobile.android/com.mnx.TestID.mobile.android.TestID
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: [debug] Trying to find test emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices…
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb devices
info: [debug] 1 device(s) connected
info: [debug] 1 emulator(s) connected
info: [debug] Sending telnet command to device: avd name
info: [debug] Getting running emulator port
info: [debug] Socket connection to device created
info: [debug] Socket connection to device ready
info: [debug] Telnet command got response: test
info: [debug] Found emulator test in port 5554
info: [debug] Setting device id to emulator-5554
info: [debug] Did not launch AVD because it was already running.
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 wait-for-device
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “echo ‘ready’”
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -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: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “getprop persist.sys.language”
info: [debug] Current device persist.sys.language:
info: [debug] java -jar “/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-adb/jars/appium_apk_tools.jar” “stringsFromApk” “/Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk” “/tmp/com.mnx.TestID.mobile.android”
info: [debug] Reading strings from converted strings.json
info: [debug] Setting language to default
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 push “/tmp/com.mnx.TestID.mobile.android/strings.json” /data/local/tmp
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from /usr/local/Cellar/android-sdk/24.4.1/build-tools/23.0.2/aapt
info: [debug] Retrieving process from manifest.
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/build-tools/23.0.2/aapt dump xmltree /Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk AndroidManifest.xml
info: [debug] Set app process to: com.mnx.TestID.mobile.android
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for /Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk.
info: [debug] executing cmd: java -jar /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-adb/jars/verify.jar /Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk
info: [debug] App already signed.
info: [debug] Zip-aligning /Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from /usr/local/Cellar/android-sdk/24.4.1/build-tools/23.0.2/zipalign
info: [debug] Zip-aligning apk.
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/build-tools/23.0.2/zipalign -f 4 /Users/mnx/Desktop/MNXSERVICES/TestID/Testing/app-release.apk /var/folders/42/szzfm39d0ll0t53s6wh74dx40000gn/T/1151115-6702-10nbesd/appium.tmp
info: [debug] MD5 for app is 32b82a0e5aaaf39cd574c98f15a3af57
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “ls /data/local/tmp/32b82a0e5aaaf39cd574c98f15a3af57.apk”
info: [debug] Getting install status for com.mnx.TestID.mobile.android
info: [debug] Getting device API level
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 23
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “pm list packages -3 com.mnx.TestID.mobile.android”
info: [debug] App is not installed
info: Installing App
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “mkdir -p /data/local/tmp/”
info: [debug] Removing any old apks
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “ls /data/local/tmp/*.apk”
info: [debug] Found an apk we want to keep at /data/local/tmp/32b82a0e5aaaf39cd574c98f15a3af57.apk
info: [debug] Couldn’t find any apks to remove
info: [debug] Uninstalling com.mnx.TestID.mobile.android
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “am force-stop com.mnx.TestID.mobile.android”
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 uninstall com.mnx.TestID.mobile.android
info: [debug] App was not uninstalled, maybe it wasn’t on device?
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “pm install -r /data/local/tmp/32b82a0e5aaaf39cd574c98f15a3af57.apk”
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 push “/Applications/Appium.app/Contents/Resources/node_modules/appium/build/android_bootstrap/AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 install “/Applications/Appium.app/Contents/Resources/node_modules/appium/build/settings_apk/settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 install “/Applications/Appium.app/Contents/Resources/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: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.mnx.TestID.mobile.android -e disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:true}
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“/data”}
info: [debug] dataDir set to: /data
info: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] Getting device API level
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “getprop ro.build.version.sdk”
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:false}
info: [debug] Device is at API Level 23
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.mnx.TestID.mobile.android/com.mnx.TestID.mobile.android.TestID”
info: [debug] Waiting for pkg “com.mnx.TestID.mobile.android” and activity “com.mnx.TestID.mobile.android.TestID” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: /usr/local/Cellar/android-sdk/24.4.1/platform-tools/adb -s emulator-5554 shell “dumpsys window windows”
info: [debug] Stopping logcat capture
error: com.mnx.TestID.mobile.android/.TestID never started. Current: com.mnx.TestID.mobile.android/.core.TestIDApplication$LanguageSelectionViewController
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
error: Could not pre-launch appium: Error: com.mnx.TestID.mobile.android/.TestID never started. Current: com.mnx.TestID.mobile.android/.core.TestIDApplication$LanguageSelectionViewController
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 22.0
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session