Unable to drag and drop element when element need to drop on a position which is generated at runtime

MobileElement element1 = idriver.findElementByAccessibilityId(“Element1”);
MobileElement element2 = idriver.findElementByClassName(“XCUIElementTypeTable”).findElementByXPath("//XCUIElementTypeStaticText[@name=“Element2”]");

If i use below code it says error "The application under test with bundle id ‘com.ABC.ABC’ is not running, possibly crashed"

TouchAction touchAction = new TouchAction(idriver);

touchAction.longPress(LongPressOptions. longPressOptions ().withElement(ElementOption. element (element1))).perform()
.moveTo(ElementOption. element ((WebElement) element2)).release().perform();

If i remove perform(), after 1st element from above code, it scrolls screen instead of long press on element.

touchAction.longPress(LongPressOptions. longPressOptions ().withElement(ElementOption. element (element1)))
.moveTo(ElementOption. element ((WebElement) element2)).release().perform();

During manual step execution process a new cell position of ‘XCUIElementTypeCell’ is generated under the element2 location and i need to drop element1 under this new cell, but this new cell position is generated at run time and it’s not a part of element2 as child element. thus i am unable to detect it as of now.
Also using above code i am not able to long press and drag element to element2 location.
I am also not able to drag and drop using exact coordinates.

*Dimension windowSize = idriver.manage().window().getSize();
int startX = 200;
int startY = 250;
int endX = 200;
int endY = 400;
Point start = new Point(startX, startY);
Point end = new Point(endX, endY);

	touchAction.press(PointOption.point(startX, startY))
			.perform()
			.moveTo(PointOption.point(endX, endY))
			.release().perform();

@Aleksei can you please look into this.

Here i am adding appium logs also for reference.
Thanks in Advance.

“perform” should be only once

@Aleksei
It crashed the application in both cases:

  1. when using coordinates to drag and drop.
  2. when using elements to drag and drop
    if I use perform() 2 times with touch action (1st after Longpress()/Press() method and 2nd after release() at the end.)

It scroll the screen instead of drag and drop (even don’t perform long press /press) in both cases:

  1. when using coordinates to drag and drop.
  2. when using elements to drag and drop

if I use perform() 1 time only with touch action (only after release() at the end.)

well - crash app is something should be fixed in app. no?

@Aleksei Definitely but that is the case when i was using perform() 2 times. as you mentioned to use it once in the end. it’s not working.
Just curious to know what else can be tried to get it work as expected.
Thanks in advance.