java.lang.NoClassDefFoundError: java.util.Objects

主宰稳场 提交于 2019-11-29 10:41:58

The exception is thrown because all static methods of java.util.Objects are available above API 19 (Android 4.4.+).

As you said in comments, your device has API 10 (Android 2.3.+) so that method doesn't exist in that Android version and NoClassDefFoundError is thrown.

If you want to check api level programmatically you can do:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    // your code available only above api 19
} else {
    // compatibility code
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!