Appium TouchAction doesn't work (on Android 8)

Hello Appium Community :sunny:

I’m in a weird situations where TouchAction would not work on my Android 8 devices but the same code would work perfectly fine on my Android 7 device. There’s no error or failure indicated in the Appium logs, but no actions are performed on the tablet either. The conclusion that this is something to do with Android versions is purely based on my observation as all the other factors are the same. However, I couldn’t find any related issues on the internet. So, I would like to reach out to see if anyone has encountered similar issues, any input would be appreciated! Thanksss

FYI, I’m using Appium v1.15.0 but the problem has happened since the previous version.

you can use the below code to scroll (up, down).

public static void scrollTo(String direction, int times) {

if (direction.equals(“down”)) {

Dimension dim = driver .manage().window().getSize();

int width = dim.getWidth() / 2;

for ( int i = 0; i < times; i++) {

int startY = ( int ) (dim.getHeight() * 0.8);

int endY = ( int ) (dim.getHeight() * 0.7);

new TouchAction( driver ).press( point (width, startY)).waitAction( waitOptions (Duration. ofMillis (300)))

.moveTo( point (width, endY)).release().perform();

}

}

if (direction.equals(“up”)) {

Dimension dim = driver .manage().window().getSize();

int width = dim.getWidth() / 2;

for ( int i = 0; i < times; i++) {

int startY = ( int ) (dim.getHeight() * 0.5);

int endY = ( int ) (dim.getHeight() * 0.9);

new TouchAction( driver ).press( point (width, startY)).waitAction( waitOptions (Duration. ofMillis (300)))

.moveTo( point (width, endY)).release().perform();

}

}

}

I tried the above one for Android 9 with Emulator, it does not throw any exception but the screen is not scrolling down and just flickering only happening