Appium freezes when finding an element in the Native app

Team,

appium version: 1.8.1
java-client:5.0.4

Whenever I tried to execute the application, it freezes in between by saying finding element and will recover automatically after 3 minutes. Please help to resolve this. Not in specific area. It will happen different place each and every execution.

There can be three reasons:

1.May be there is a problem with xpath.

2.It’s better to clear Appium server cache by using below command:

            npm clear cache --f 

3.Still if your getting problem,make sure that your using command based appium server or not
(i.e,Nodejs).