Error:Appium Settings app is not running after 30000ms

I want to run the emultaor in headless , but in doing so i am getting the issue as

“Error: Appium Settings app is not running after 30000ms” while everything is running fine when i am not using headless mode.
I had attached the appium logs .
I am using appium version 2.5.4 and appium java client 9.2.2
When i am running emulator in headless it is running fine with Android 10 .It is creating issue in case of Android 13 and 14.
Appium logs.txt (38.9 KB)

I had done all the mentioned things .
“appium:isHeadless”: true,
“appium:avd”: “Android13”,

I am using the following capabilities
{
“platformName”: “ANDROID”,
“appium:avdLaunchTimeout”: 120000,
“appium:appPackage”: “com.whatsapp”,
“appium:autoGrantPermissions”: true,
“appium:noReset”: true,
“appium:platformVersion”: “13”,
“appium:newCommandTimeout”: 120,
“appium:avdArgs”: “-netfast -no-boot-anim”,
“appium:avdReadyTimeout”: 120000,
“appium:isHeadless”: true,
“appium:avd”: “Android13”,
“appium:ignoreHiddenApiPolicyError”: true,
“appium:appActivity”: “com.whatsapp.Main”,
“appium:automationName”: “UiAutomator2”
},

Main issue is i am getting
Error:Appium Settings app is not running after 30000 ms

Due to which app is not launching

I can see that you’ve added a comment on this bug:

Are you also running in Docker instance? As noted in bug report, may need a more powerful host.

No, i am running appium server locally and using the emulator created on same device using Android Studio.

This emulator is taking almost 2 minutes to boot up, which is really slow. Any way you can optimize that?

Maybe some help here:

Maybe more here:

I am already using the below capabilities
“appium:avdReadyTimeout”: 120000,
“appium:avdLaunchTimeout”:120000

and i think the emulator taking 116033 ms is not an issue here because at the end it is getting recognized
Please check the part of the logs below

[ADB] Getting connected devices
[ADB] Connected devices: [{“udid”:“emulator-5554”,“state”:“device”}]
[ADB] 1 emulator connected
[ADB] Overriding C:\Users\Sanskar.emulator_console_auth_token with an empty string to avoid telnet authentication for emulator commands
[ADB] Executing Emulator console command: avd name
[ADB] Found emulator ‘Android13’ on port 5554
[ADB] Setting device id to emulator-5554
[ADB] Running ‘C:\Users\Sanskar\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 wait-for-device’
[ADB] Running ‘C:\Users\Sanskar\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’: 33
[ADB] Getting device platform version
[ADB] Running ‘C:\Users\Sanskar\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’: 13
[ADB] Device API level: 33

I tried the solution you provided to reduce the boot time .It reduces my boot time to 49946 ms . But still i am getting the same issue .
Below are the appium logs for it.

[AndroidUiautomator2Driver@4624 (28a24311)] Error: Appium Settings app is not running after 30000ms
[AndroidUiautomator2Driver@4624 (28a24311)] at SettingsApp.requireRunning (C:\Users\Sanskar.appium\node_modules\appium-uiautomator2-driver\node_modules\io.appium.settings\lib\client.js:96:13)
[AndroidUiautomator2Driver@4624 (28a24311)] at AndroidUiautomator2Driver.pushSettingsApp (C:\Users\Sanskar.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\commands\device\utils.js:250:5)
[AndroidUiautomator2Driver@4624 (28a24311)] at AndroidUiautomator2Driver.initDevice (C:\Users\Sanskar.appium\node_modules\appium-uiautomator2-driver\node_modules\appium-android-driver\lib\commands\device\common.js:221:5)
[AndroidUiautomator2Driver@4624 (28a24311)] Deleting UiAutomator2 session
[AndroidUiautomator2Driver@4624 (28a24311)] Unable to stop ChromeDriver proxies: Cannot read properties of undefined (reading ‘proxyReqRes’)

CompleteAppium_logs.txt (36.6 KB)

Can you tell if settings app is getting installed at all?

Good info here:

When i am running the emulator with UI at that time , settings app is getting installed and everything is running fine .I am facing issue only in case of headless execution and particularly with Android version 13 and 14 .I had attached the appium logs . Hope that appium logs might help you to get idea that settings app is getting installed or not.

Appium logs.txt (38.9 KB)

The logs say it’s installed but not started. I can’t really reach through the internet and check the emulator, so I do have to rely on your description of whether it’s truly installed or not. Like if it’s installed but in a bad state and can’t start. As mentioned in some of these links, could use logcat to see if there is a failure starting up. There is a lot of good troubleshooting advice shared in this thread.

If it is installed but in a bad state, that last link has some adb commands to help fix it. I guess you could just run them anyway. Hope it works out for you.

Hi @wreed , sorry for the late reply . I was super busy in the past week . I will go through the links and will try to do the step suggested in the link.
And will update you.

1 Like

I had tried with the commands which are listed in the thread but still getting the issue specifically with Android 13 and 14 in headless mode.

Error: Appium Settings app is not running after 30000ms

I am attaching the Appium server logs , adb logcat and adb shell ps.

Appium logs.txt (38.9 KB)
logcat last 10 sec.txt (118.3 KB)
Full adb logcat logs.txt (872.3 KB)
adb shell ps.txt (104.9 KB)

For adb shell ps , i had only attached logs for the duration in which i got failure

Hie man, I have had the same problem since last year. Right after booting up Android Emulator programmatically, appium settings isn’t stable on the very first Test.
I suggest you create a simple mock test to try to manually open the settings app (this test is just an attempt to initialise and run the settings app, doesn’t matter if it passes or fails)
After the mock test then Run your actual tests, usually after the first test, all tests should run without issues.
Example:

@Test(priority  = 0)
public void initialiseAppiumSettingApp_IgnoreResult() throws InterruptedException, IOException {
        int i = 0;
        while (!androidDriver.getCurrentPackage().equals("io.appium.settings")){
            androidDriver.activateApp("io.appium.settings");
            Thread.sleep(200);
            if(androidDriver.getCurrentPackage().equals("io.appium.settings")){
                System.out.println("Opened appium setting app: "+androidDriver.getCurrentPackage());
                break;
            }else{
                System.out.println("Couldn't open appium settings app: "+androidDriver.getCurrentPackage());
                Thread.sleep(500);
                if(i>10){
                break;
                }
            }
            i++;
        }
        Thread.sleep(2000);
    }