How to deal with ANR ( Application not responding) error.

Application not responding (ANR) is an error Android system displays if an application doesn't respond to user input.

ANR will be triggered for app if
1) A app has not responded to user input within 5 seconds.
2) A BroadcastReceiver hasn't finished executing within 10 seconds.

2/3 years old devices with low RAM and CPU power might display ANRs for new Apps.
Solution -
1) Keep only essential apps and uninstall unnecessary apps.
2) Use some kind of RAM/Cache cleaner app.
3) Avoid using widgets and live wallpapers, they occupy lot of RAM .
4) Stop unnecessary apps and processes from background, that will reduce load on system and improve its performance.

If all apps ( or majority of apps) on your device showing ANR, then possible causes are
1) The operating system of device has corrupted.
2) Device might have hardware failure.

Solution - Flash device ROM with original OS or replace failed hardware at authorised service centre.

If a single app is showing ANR, then there 2 possible cause.
1) It requires high system resources like more RAM and CPU power than available on device. Example - Current popular game PUBG doesn't work properly on devices with 2GB or less RAM.
2) May be it is not properly developed by its creators.

Solution - avoid such apps and also uninstall unnecessary apps.