Could not run android mobile app

Hi everyone
I just installed Katalon Studio ( Version 10.0.0 ) and tried to run the first mobile app ( Android ). Unfortunately, it didn’t work. On mobile devices, I already enable USB debugging and other conditions.
Please help me to resolve this bug. Thanks for your support.

Hi @tientranmanh0612,

Welcome to our community. Thank you for sharing your issue.

Can you share which UIAutomator version you are using? If it’s not the latest, we recommend you upgrade to the latest or at least UIAutomator v3x. Thank you!

just try to execute this command @tientranmanh0612

appium driver list --installed

I have seen a tutorial from Katalon guy that UIAutomator v3x or the latest will not works on the scroll function. but I forgot where is the tutorial link

Hi @Elly_Tran
Thanks for your support.
I checked, and this is the information
Uiautomator2 server,
Version Name:** 4.17.4 Version Code:** 79`
I try to update the version but it fails


I’m beginner. Help us

What should I do now.

Hi @ganthonym
I just tried this


I also tried to reinstall Appium and Uiautomator2, but this issue still happened

sometimes, just sometimes. restart your PC or your device will help.

or try this one, https://forum.katalon.com/t/how-do-i-solve-the-fail-to-start-appium-server-in-60-seconds-error/86624

Hi Guys,
I successfully installed Appium and UI Automator and can run the mobile device.
Thanks to all of you for your support.
But when I tried to create a test case with the record mobile function, there was an error ( It only happened with the login screen of the mobile app that I tried to record )

org.openqa.selenium.remote.ScreenshotException: Failed to capture a screenshot. Does the current view have 'secure' flag set?
Build info: version: '4.22.0', revision: 'c5f3146703'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.7'
Driver info: io.appium.java_client.android.AndroidDriver
Command: [f83436cc-c747-4606-8304-aa9474434726, screenshot {}]
Capabilities {appium:appActivity: .Settings, appium:appPackage: com.android.settings, appium:autoGrantPermissions: true, appium:automationName: uiautomator2, appium:databaseEnabled: false, appium:desired: {appActivity: .Settings, appPackage: com.android.settings, autoGrantPermissions: true, automationName: uiautomator2, deviceId: , deviceName: Xiaomi Redmi Note 9S (Andro..., newCommandTimeout: 1800, platformName: ANDROID, platformVersion: 10, systemPort: 8200, udid: 8e2cddff}, appium:deviceApiLevel: 29, appium:deviceId: , appium:deviceManufacturer: Xiaomi, appium:deviceModel: Redmi Note 9S, appium:deviceName: 8e2cddff, appium:deviceScreenDensity: 440, appium:deviceScreenSize: 1080x2400, appium:deviceUDID: 8e2cddff, appium:javascriptEnabled: true, appium:locationContextEnabled: false, appium:networkConnectionEnabled: true, appium:newCommandTimeout: 1800, appium:pixelRatio: 2.75, appium:platformVersion: 10, appium:statBarHeight: 102, appium:systemPort: 8200, appium:takesScreenshot: true, appium:udid: 8e2cddff, appium:viewportRect: {height: 2298, left: 0, top: 102, width: 1080}, appium:warnings: {}, appium:webStorageEnabled: false, platformName: ANDROID}
Session ID: f83436cc-c747-4606-8304-aa9474434726
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at org.openqa.selenium.remote.ErrorCodec.decode(ErrorCodec.java:167)
	at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:138)
	at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:50)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:190)
	at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:237)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:591)
	at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:310)
	at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:321)
	at io.appium.java_client.AppiumDriver.getScreenshotAs(AppiumDriver.java:319)
	at com.kms.katalon.composer.mobile.objectspy.dialog.MobileInspectorController.captureScreenshot(MobileInspectorController.java:374)
	at com.kms.katalon.composer.mobile.objectspy.dialog.MobileObjectSpyDialog$6.captureImage(MobileObjectSpyDialog.java:688)
	at com.kms.katalon.composer.mobile.objectspy.dialog.MobileObjectSpyDialog$6.run(MobileObjectSpyDialog.java:613)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Is there any idea about this error?

Hi @tientranmanh0612,

It is great to hear that you have solved it. Please help give more details on how you solve it so that other people can take is as reference.

The error org.openqa.selenium.remote.ScreenshotException: Failed to capture a screenshot. Does the current view have a 'secure' flag set? indicates that Selenium was unable to capture a screenshot, likely due to restrictions or flags set on the application you’re testing.
In Android applications, for instance, a secure flag can be set on a view (using FLAG_SECURE in Android development) to prevent screenshots or video recording for security purposes.

  1. Check for Secure Flag
    The FLAG_SECURE might be set in the app’s code to prevent screenshots. You can contact the developer to disable this flag while testing.

  2. Use Alternative Screenshot Methods
    If the built-in screenshot feature isn’t working, try alternative methods:

  1. Ensure Proper Permissions
    For mobile apps, ensure that the test automation tool has the necessary permissions to capture screenshots.

    • In Android, make sure the app’s testing environment doesn’t have restrictions like “Screen Overlay Detected.”
  2. Disable Secure Flag (For Mobile Apps)
    If you are able to modify the application:

    • In Android, remove or comment out the line where FLAG_SECURE is set:
      getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
      

Let me know if you need further support!

I just tried to reinstall Appium, and then UI Automator ( Version 2, not 3 ). After that, I reset the setup configuration, and when I tried to record again, the device was connected.

I follow your comment, unfortunately, it still doesn’t work
One more thing when I try to another device, the screen in Katalon studio doesn’t display anything while the function on the mobile device is working normally (No errors)


The Katalon studio seems unstable. Haiz. One app and many issues happened.

try to use @tientranmanh0612 emulator instead if your real device seems not works