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
wreed
May 6, 2024, 7:24pm
4
I can see that you’ve added a comment on this bug:
opened 03:09PM - 20 Mar 24 UTC
closed 01:41PM - 25 Mar 24 UTC
Android
ThirdParty
### Do I have the most recent component updates?
- [X] I use the most recent … available driver/plugin and server versions
### Is the component officially supported by the Appium team?
- [X] I have verified the component repository is present under the Appium organization in GitHub
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
I am facing an issue while executing my appium robot framework test script.
I have a docker container in which an android emulator and appium server are running.
I am getting the following error "Appium Settings app is not running after 30000ms", I couldn't fix this issue after reading forums and trying everything and I am still getting the same issue while running my test script.
### Expected Behavior
I expect the test to pass without having errors.
### Environment
- Docker Base Image to run Appium: openjdk:18-jdk-slim
- Host OS : Windows
- Appium server version: 2.5.1
- Appium driver(s) and their version(s): [email protected]
- Node.js version: v20.11.1
- `npm` version: 10.5.0
- Platform and version under test: google pixel 4 xl & android version 14 (api level 34)
- Real device or emulator/simulator: Emulator
### Link to Appium Logs
https://gist.github.com/QwetaDoja/a51f7d48c340555373d52989129786f4
### Further Information
adb logcat logs: https://gist.github.com/QwetaDoja/ae3bfafc381c41891c5fdc9dd4ecb33e
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.
wreed
May 7, 2024, 4:33am
6
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)
wreed
May 7, 2024, 3:18pm
9
Can you tell if settings app is getting installed at all?
Good info here:
opened 11:27AM - 21 Apr 20 UTC
closed 05:15PM - 27 Apr 20 UTC
Android
ThirdParty
I am facing an issue while executing my appium test script.
I am getting an err… or "Appium Settings app is not running after 5000ms" error, I couldn't fix this issue after reading forums then I uninstalled android studio, node.js, appium and again reinstalled everything but still 'm getting same issue while running my appium script.
Below version is installed in my system
Android studio version: 3.6.2
Node version: v13.13.0
Npm version: 6.14.4
Appium version: Appium v1.17.0
I installed appium by below command, which mentioned in link (http://appium.io/)
npm install -g appium # get appium
npm install wd # get appium client
**TestCase:**
package SampleProject;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
public class AppiumTest {
public static void main(String[] args) {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("deviceName", "Brij");
caps.setCapability("udid", "ba5e03b");
caps.setCapability("platformName", "Android");
caps.setCapability("platformVersion", "9.0");
caps.setCapability("appPackage", "in.amazon.mShop.android.shopping");
caps.setCapability("appActivity", "com.amazon.mShop.home.HomeActivity");
caps.setCapability("noReset", "true");
try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
}
}
**Appium Error:**
Encountered internal error running command: Error: Appium Settings app is not running after 5000ms
[debug] [W3C] at ADB.requireRunningSettingsApp (mylocalpath\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\tools\settings-client-commands.js:70:11)
**Complete Error Log:**
[Appium] Welcome to Appium v1.17.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":"com.amazon.mShop.home.HomeActivity","appPackage":"in.amazon.mShop.android.shopping","noReset":"true","platformVersion":"9.0","platformName":"Android","udid":"ba5e03b","deviceName":"Brij"},"capabilities":{"firstMatch":[{"appium:appActivity":"com.amazon.mShop.home.HomeActivity","appium:appPackage":"in.amazon.mShop.android.shopping","appium:deviceName":"Brij","appium:noReset":"true","platformName":"android","appium:platformVersion":"9.0","appium:udid":"ba5e03b"}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.amazon.mShop.home.HomeActivity","appPackage":"in.amazon.mShop.android.shopping","noReset":"true","platformVersion":"9.0","platformName":"Android","udid":"ba5e03b","deviceName":"Brij"},null,{"firstMatch":[{"appium:appActivity":"com.amazon.mShop.home.HomeActivity","appium:appPackage":"in.amazon.mShop.android.shopping","appium:deviceName":"Brij","appium:noReset":"true","platformName":"android","appium:platformVersion":"9.0","appium:udid":"ba5e03b"}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1587468149931 (16:52:29 GMT+0530 (India Standard Time))
[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.17.0 creating new AndroidUiautomator2Driver (v1.44.2) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] "alwaysMatch": {
[debug] [BaseDriver] "platformName": "android",
[debug] [BaseDriver] "appium:appActivity": "com.amazon.mShop.home.HomeActivity",
[debug] [BaseDriver] "appium:appPackage": "in.amazon.mShop.android.shopping",
[debug] [BaseDriver] "appium:deviceName": "Brij",
[debug] [BaseDriver] "appium:noReset": "true",
[debug] [BaseDriver] "appium:platformVersion": "9.0",
[debug] [BaseDriver] "appium:udid": "ba5e03b"
[debug] [BaseDriver] },
[debug] [BaseDriver] "firstMatch": [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: 24cdc388-1ca0-4fe8-ad47-5e0c2ad4d3ac
[UiAutomator2] Starting 'in.amazon.mShop.android.shopping' directly on the device
[ADB] Found 1 'build-tools' folders under 'myLocalPath\AppData\Local\Android\Sdk' (newest first):
[ADB] C:/Users/Qapitol/AppData/Local/Android/Sdk/build-tools/29.0.3
[ADB] Using 'adb.exe' from 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] Connected devices: [{"udid":"ba5e03b","state":"device"},{"udid":"emulator-5554","state":"device"}]
[AndroidDriver] Using device: ba5e03b
[ADB] Using 'adb.exe' from 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[debug] [ADB] Setting device id to ba5e03b
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell getprop ro.build.version.sdk'
[debug] [ADB] Current device property 'ro.build.version.sdk': 28
[ADB] Getting device platform version
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell getprop ro.build.version.release'
[debug] [ADB] Current device property 'ro.build.version.release': 9
[debug] [ADB] Device API level: 28
[UiAutomator2] Relaxing hidden api policy
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell settings put global hidden_api_policy_pre_p_apps 1'
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell settings put global hidden_api_policy_p_apps 1'
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell settings put global hidden_api_policy 1'
[AndroidDriver] No app sent in, not parsing package/activity
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b wait-for-device'
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell echo ping'
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b 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 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b 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 ('3.1.0' >= '3.1.0')
[debug] [ADB] There is no need to install/upgrade 'myLocalPath\AppData\Roaming\npm\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell 'pgrep --help; echo $?''
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Starting Appium Settings app
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell am start -n io.appium.settings/.Settings -a android.intent.action.MAIN -c android.intent.category.LAUNCHER'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [ADB] Getting IDs of all 'io.appium.settings' processes
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell pgrep -f io\\.appium\\.settings'
[debug] [AndroidDriver] Error: Appium Settings app is not running after 5000ms
[debug] [AndroidDriver] at ADB.requireRunningSettingsApp (myLocalPath\AppData\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\tools\settings-client-commands.js:70:11)
[debug] [UiAutomator2] Deleting UiAutomator2 session
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell am force-stop in.amazon.mShop.android.shopping'
[UiAutomator2] Restoring hidden api policy to the device default configuration
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell settings delete global hidden_api_policy_pre_p_apps'
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell settings delete global hidden_api_policy_p_apps'
[debug] [ADB] Running 'myLocalPath\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ba5e03b shell settings delete global hidden_api_policy'
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1587468158491 (16:52:38 GMT+0530 (India Standard Time))
[debug] [W3C] Encountered internal error running command: Error: Appium Settings app is not running after 5000ms
[debug] [W3C] at ADB.requireRunningSettingsApp (myLocalPath\AppData\Roaming\npm\node_modules\appium\node_modules\appium-adb\lib\tools\settings-client-commands.js:70:11)
[debug] [W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 8653 ms - 659
[HTTP]
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)
wreed
May 7, 2024, 7:54pm
11
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
derolk
May 14, 2024, 10:50pm
14
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);
}