android - 无特定原因获得空指针异常 [英] android - getting nullpointerexception for no specific reason

查看:17
本文介绍了android - 无特定原因获得空指针异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 android 项目,据我所知,我没有在代码中犯任何会导致异常的特定错误.

I am working on an android project and as far as I know, I don't make any specific mistakes in my code that would lead to an exception.

我每次运行我的项目时都会收到这两条错误行,但我的其余代码运行没有任何问题.

I get these two error lines everytime I run my project, but the rest of my code runs without any issues.

NullPointerException 没有具体的发生位置,这让我很困惑.

The NullPointerException doesn't have a concrete occurance location, which confuses me.

我已经搜索过类似的问题.一个可能的解决方案是在我的 Android 清单文件中添加 READ_EXTERNAL_STORAGE 和 WRITE_EXTERNAL_STORAGE 作为使用权限,但无济于事.

I have already searched for similar issues. A possible solution was adding the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE as uses-permission in my Android Manifest file, but to no avail.

2020-02-28 XX:XX:XX.333 14615-14651/com.example.package_name E/Perf: Fail to get file list com.example.package_name
2020-02-28 XX:XX:XX.333 14615-14651/com.example.package_name E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array

推荐答案

这个错误是我的 OnePlus 抛出的,在 android 模拟器上没有显示错误

The error was thrown by my OnePlus, on the android emulator there was no error shown

这篇关于android - 无特定原因获得空指针异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆