Q) If IG app starts to crash again and again, make sure that you've disabled the "Battery Optimization" for the Automation Server App. As by Default Battery Optimization kills the background apps after some time. Which causes issues in automation.

 

Solution:

To do this,

  1. In phone settings, go to Battery –> App Launch (Or any other option for managing background Apps) –> search “uiautomator” . (See below image).
 

image
 

2. disable battery optimization for all the apps in search result (See below image).

 

 

Solution 2:

To do this,

  1. In phone settings, click on “Apps” .
  2. (This step is only required on some phones) Again click on “Apps” option in the options list.
  3. click on the “3 dots icon” in the top right corner of the screen.
  4. Select “Special access“.
  5. Select “Battery Optimization“.
  6. Now from the dropdown select “All apps“.
  7. Search “uiautomator“.
  8. Tap on each result 1 by 1 and disable the Battery optimization for each of them if that is enabled.
 

NOTE: IF AVAILABLE, DO BOTH Solution 1 And Solution 2.

UPDATE:

2. For “821. Automation Variant Type: 4″ also do the same as above for “Culebra” (see below image).

 

 

 

And Note:

In some phones there might be some other Optimization app also present (that kills background Apps) (maybe installed manually from the play store). Need to whitelist Automation Server app in those apps as well if any present.