can someone knows how to replicate ANR (app not responding) on android app , we are getting lots of issues on our android app, but those are very tricky to replicate, we don’t know what is root cause then we can easily able to see if that is fixed or not
here is an example of ANR stuff , but we saw sometimes on login screen , it gives popup app not responding
I’m facing the same issue, but this is kind of tricky, for me it depends on a lot of factors like Ram, internet connection, specifications of the device, etc, that’s why isn’t easy to reproduce, and most likely is happening in 1/1000.
There are 2 ways that can assist with this, but none are guaranteed to reproduce the issues.
One way is to instrument logging to your application, where on app error or crash, it will send data to the cloud. I am assuming, if it is not able to catch the error/crash before it occurs, sometimes it may be able to get the “crash” data after restart of the application and send it to the cloud on next startup. I do not know the details of such instrumentation and logging, but there are services/frameworks/infrastructure for that such as sentry.io, Firebase, Crashlytics, etc. It might not be free. Or you can always build your own. This might be harder for some scenarios if the app is a web-app compared to a real installed Android app, as web-app case you can only catch web app specific issues and not browser specific issues if browser hangs or crashes.
Another way to help try to reproduce such issues, is in a prior job, we did monkey testing, where the tester just does random actions (or rather to say, press random keys on our product - a telephone base system). In this case the monkey testing for Android app could be doing any/all sorts of tapping swiping on the screen along with pressing buttons if any on the device like the volume/power/home buttons, etc. Also consider random speech triggering for the voice commands to the Android device as well.
For factors related to resource utilization CPU/memory, and internet connectivity, you can try reproducing by also instrumenting/controlling the test conditions, like limiting the internet connection reliability or speed via use of tools configured against the Android device via proxy server connection or via adjusting the actual network the device is connected to (i.e. configure the wifi network to restrict bandwidth to the device tracked by its MAC address). For CPU/memory, look for tools/apps that you can install on device or using the features of Android studio or ADB in developer/debug mode to force high CPU or high memory allocation elsewhere so the device’s system is already low performing, then test your app to see how it behaves under these conditions. I’m not aware of specific tooling/steps details for such process though. This is easier to do on Windows/MacOS than mobile.
On iOS there is or was a network link conditioner feature to help simulate network issues on device during testing, not sure if Android has similar tooling.