My Android app gets a lot of ANR reports lately in the Google Play console. Since this started to happen when I included Google Analytics in the app, I strongly suspect Analytic
But how to know where it is blocked?
Start by enabling StrictMode and running your app. If you (or Analytics) are doing disk or network I/O on the main application thread, you will find out about it, based upon your chosen penalty style (e.g., log in LogCat):
public void onCreate() {
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
}
super.onCreate();
// rest of onCreate() logic here
}