Instrumentation run failed due to 'Process crashed.' after long tests execution

▼魔方 西西 提交于 2019-12-05 10:04:19

I don't know if the problem is still actual for you, but I have encountered such problem myself. There was a bug in certain Android versions on Samsung devices: they didn't close file descriptors properly thus creating file descriptors leak. After 1028 descriptors are created - the process crashes.

http://code.google.com/p/android/issues/detail?id=32470

To avoid this I had to cut on the usage of HandlerThreads in my tests, and re-use them where possible. But the better solution would be to change the device, probably.

Try to run instrumentation tests on a newer version of Android OS, like Android 5.1 (API 22) or above. Some older versions, like Android 4.1, would have crashes like this on the ARM emulator.

Or try updating the Gradle version used in your project. For example, Gradle 4.1 would have this problem, but gradle 4.10 should not.

Alternatively, try to avoid running tests in the background, where no Activity is launched. So avoid using ActivityUnitTestCase and SingleLaunchActivityTestCase which can cause a native C++ crash on Android 4.1. More info here: Native crash at /dev/ashmem/dalvik-jit-code-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!