NoClassDefFoundError: android.app.ANRManagerProxy NoClassDefFoundError: android.app.ANRManagerProxy android android

NoClassDefFoundError: android.app.ANRManagerProxy


This error can be seen on a small group of devices (I don't have a list, but they tend to be no-name brands) whose firmware developers, for unknown reasons, removed the ANRManagerProxy from the device framework (I confirmed this by hunting down a firmware and decompiling it myself).

The best you can do is try to hunt down any possible code which could be locking up the thread and causing the device to become nonresponsive, and try to use an AsyncTask or similar to run the code asynchronously and avoid the ANR. The devices in question are always low end, and so your code will take longer to run and have a greater chance of causing this to happen.

I'd suggest Hugo as a great library for debugging method execution times, in order to narrow your focus on where the most time is being spent. This will help improve your code for all users, as well as reducing the risk of the crash in question.


This happens, because

  • your app id doing some heavy work in main (GUI) thread

and

  • target device has messed up firmware

Here is a list of devices, where I experienced more frequently the bug - so not only low end devices, be careful you will ignore it :-)

Lenovo A316i, N5i, V769M , G3 orro, V5, G3, X-2, F-G906, Z350, V10, G910, EVOLVEO StrongPhone D2, A70C, G9006, V13, C3000, n968, SM-T322, H9503, GT-H9503, S5, F1, Lenovo TP-6000, Galaxy Tab SM-T700C ...

Only thing you can do about this is to make your app responsive. Best way to do so is to use during development and testing Strict Mode, i.e., to do something like this:

public void onCreate() {    if (DEVELOPER_MODE) {        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()             .detectDiskReads()             .detectDiskWrites()             .detectNetwork()   // or .detectAll() for all detectable problems             .penaltyLog()             .build());        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()             .detectLeakedSqlLiteObjects()             .detectLeakedClosableObjects()             .penaltyLog()             .penaltyDeath()             .build());    }    super.onCreate();}