Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If emulated device is not running, Appium always failed with "Error type 3..." #851

Open
HSerg opened this issue Dec 16, 2024 · 5 comments

Comments

@HSerg
Copy link

HSerg commented Dec 16, 2024

If emulated device is not running, Appium always failed with Error: Cannot start the 'io.appium.settings' application. Consider checking the driver's troubleshooting documentation. Original error: Error executing adbExec. Original error: 'Command '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start-activity -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER' exited with code 1'; Command output: Error type 3 Error: Activity class {io.appium.settings/io.appium.settings.Settings} does not exist.

If the device has already been running, there is no error.

Environment

  • Ubuntu 22.04
  • Appium 2.13.1
  • uiautomator2 driver 3.9.5
  • Android emulator 35.2.10
  • Android 15, image system-images;android-35;google_apis;x86_64

Appium Server logs

[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell cmd reboot_readiness check-subsystems-state --list-blocking'
[2358fa3b][ADB] Waiting for emulator startup. Intermediate state: cmd: Can't find service: reboot_readiness

[2358fa3b][ADB] [AVD OUTPUT] DEBUG   | _hwFingerprint_connect: connect finger print listen is called
[2358fa3b][ADB] [AVD OUTPUT] DEBUG   | got message from guest system fingerprint HAL
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell cmd reboot_readiness check-subsystems-state --list-blocking'
[2358fa3b][AndroidUiautomator2Driver@1a72] Using device: emulator-5554
[2358fa3b][ADB] Using 'adb' from '/opt/android-sdk/platform-tools/adb'
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 start-server'
[2358fa3b][ADB] Setting device id to emulator-5554
[2358fa3b][AndroidUiautomator2Driver@1a72] We're going to run a Chrome-based session
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[2358fa3b][ADB] Current device property 'ro.build.version.sdk': 35
[2358fa3b][ADB] Getting device platform version
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[2358fa3b][ADB] Current device property 'ro.build.version.release': 15
[2358fa3b][ADB] Device API level: 35
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell cmd package resolve-activity --brief com.android.chrome'
[2358fa3b][AndroidUiautomator2Driver@1a72] Using the default com.android.chrome activity com.google.android.apps.chrome.Main. Original error: Unable to resolve the launchable activity of 'com.android.chrome'. Original error: No activity found
[2358fa3b][AndroidUiautomator2Driver@1a72] Chrome-type package and activity are com.android.chrome and com.google.android.apps.chrome.Main
[2358fa3b][AndroidUiautomator2Driver@1a72] Starting 'com.android.chrome' directly on the device
[2358fa3b][AndroidUiautomator2Driver@1a72] Relaxing hidden api policy
[2358fa3b][ADB] Running '/opt/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''
[2358fa3b][AndroidUiautomator2Driver@1a72] No app sent in, not parsing package/activity
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 wait-for-device'
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell echo ping'
[2358fa3b][AndroidUiautomator2Driver@1a72] Pushing settings apk to the device...
[2358fa3b][ADB] Getting package info for 'io.appium.settings'
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[2358fa3b][ADB] Using 'aapt2' from '/opt/android-sdk/build-tools/34.0.0-rc2/aapt2'
[2358fa3b][ADB] Reading package manifest: '/opt/android-sdk/build-tools/34.0.0-rc2/aapt2 dump badging /home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[2358fa3b][ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('5.12.19' >= '5.12.19')
[2358fa3b][ADB] There is no need to install/upgrade '/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/io.appium.settings/apks/settings_apk-debug.apk'
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys activity services io.appium.settings'
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell cmd notification allow_listener io.appium.settings/.NLService'
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell appops set io.appium.settings PROJECT_MEDIA allow'
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys activity services io.appium.settings'
[2358fa3b][SettingsApp] Starting Appium Settings app
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start-activity -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER'
[2358fa3b][AndroidUiautomator2Driver@1a72] Error: Cannot start the 'io.appium.settings' application. Consider checking the driver's troubleshooting documentation. Original error: Error executing adbExec. Original error: 'Command '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start-activity -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER' exited with code 1'; Command output: Error type 3
Error: Activity class {io.appium.settings/io.appium.settings.Settings} does not exist.

    at ADB.startApp (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-adb/lib/tools/apk-utils.js:226:11)
    at SettingsApp.requireRunning (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/io.appium.settings/lib/client.js:75:5)
    at AndroidUiautomator2Driver.pushSettingsApp (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/device/utils.js:252:5)
    at AndroidUiautomator2Driver.initDevice (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/device/common.js:228:5)
[2358fa3b][AndroidUiautomator2Driver@1a72] Deleting UiAutomator2 session
[2358fa3b][ADB] Running '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys activity services io.appium.settings/.recorder.RecorderService'
[2358fa3b][AndroidUiautomator2Driver@1a72] Restoring hidden api policy to the device default configuration
[2358fa3b][ADB] Running '/opt/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''
[2358fa3b][AppiumDriver@86c6] Event 'newSessionStarted' logged at 1734301730689 (22:28:50 GMT+0000 (Coordinated Universal Time))
[2358fa3b][AppiumDriver@86c6] Encountered internal error running command: Error: Cannot start the 'io.appium.settings' application. Consider checking the driver's troubleshooting documentation. Original error: Error executing adbExec. Original error: 'Command '/opt/android-sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start-activity -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER' exited with code 1'; Command output: Error type 3
Error: Activity class {io.appium.settings/io.appium.settings.Settings} does not exist.

    at ADB.startApp (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-adb/lib/tools/apk-utils.js:226:11)
    at SettingsApp.requireRunning (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/io.appium.settings/lib/client.js:75:5)
    at AndroidUiautomator2Driver.pushSettingsApp (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/device/utils.js:252:5)
    at AndroidUiautomator2Driver.initDevice (/home/user/.appium/node_modules/appium-uiautomator2-driver/node_modules/appium-android-driver/lib/commands/device/common.js:228:5)
[2358fa3b][HTTP] <-- POST /session 500 28553 ms - 1494
[2358fa3b][ADB] [AVD OUTPUT] INFO    | Boot completed in 33194 ms
[2358fa3b][ADB] [AVD OUTPUT] INFO    | Increasing screen off timeout, logcat buffer size to 2M.
@KazuCocoa
Copy link
Member

I'm not sure you already tried as no logs but did you try out appium:avdReadyTimeout?

@HSerg
Copy link
Author

HSerg commented Dec 19, 2024

Yes, I tried this. Above log with the following settings:

options.setUiautomator2ServerInstallTimeout(Duration.ofMinutes(5));
options.setUiautomator2ServerLaunchTimeout(Duration.ofMinutes(5));
options.setAvdReadyTimeout(Duration.ofMinutes(5));
options.setAvdLaunchTimeout(Duration.ofMinutes(5));
options.setAndroidInstallTimeout(Duration.ofMinutes(5));
options.setAdbExecTimeout(Duration.ofMinutes(5));

@KazuCocoa
Copy link
Member

Please attache the full server log as a gist. It looks like emulator booting status then

@HSerg
Copy link
Author

HSerg commented Dec 19, 2024

@KazuCocoa
Copy link
Member

I don’t have development environment for now, so can’t check it out but it looks like emulator or android os related just after the os starts.

If the device has already been running, there is no error.

Did you check it when Appium started while the device was starting? So, the emulator was not up completed yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants