当我尝试检查外部存储(已安装/未安装)的状态时,我遇到了随机崩溃
这是我用来检查并获取外部目录(如果已安装
)的条件 if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) && context.getExternalCacheDir() != null) {
这就是我得到的崩溃:
Fatal Exception: java.lang.RuntimeException:
android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
at android.os.storage.StorageManager.getVolumeList(StorageManager.java:890)
at android.os.Environment$UserEnvironment.getExternalDirs(Environment.java:11)
at android.os.Environment.getExternalStorageState(Environment.java:674)
有谁知道为什么会一直这样,以及如何避免它?