NoSuchElementFoundExeption in android native app


Appium version 1.12.1 windows 10 working platform=android version 5.1.1,4.4,6.0 Not working in android version 7.1 and above

I am getting NoSuchElementFoundExeption error contineously during following scenario in android app

Before loading the page there is RestAPI call requesting data from server during this a progressDailogue is shown,so once after page loaded it shows the data with native components(textview,buttons etc) and the progressDailoogue hides.

Once the native elements are displayed I am trying to click on the element by using ID(tried by xpath) but it is showing NoSuchElementFoundExeption also I tried by using wait method and adding some delay still it is displaying the same error.

I tried by removing the process dailog box in my app where it works fine, But I wanted to find the element and click on the element without removing the process dailog box.

This is sample code tried

WebDriverWait wait = new WebDriverWait(driver, 120);

How to get the elements click working after hiding progressDailogue.

So any help on this ???