0

It is a Huawei P20, model EML-AL00, Build 10.0.0.156 (EMUI 10.0.0).

I had to upgrade the OS to the last version, Android 10. I delayed this until I could, aware of the danger, but it is annoyng to close an update popup every time you activate the device.

Now some apps are not opening, I discovered many errors, i.e., on API retrieving phone data, or retrieving file information,

final String rootPath = Environment.getExternalStorageDirectory().toString() + "/";
File f = new File(path); // path, e.g., /storage/emulated/0/
File[] files = f.listFiles();

returns null on this phone (and only on this phone). I'd like to solve this.

Anybody found any reason why? Permission are declared and granted, I repeat, it seems to be an issue / bug / "feature" of this phone.

1 Answers1

0

Skip the trailing slash. It's a bug on some systems (including Samsung if I recall correctly).

l33t
  • 18,692
  • 16
  • 103
  • 180
  • Not easy as that unfortunately, it is one of the things I tried, placing all trailing slashes one by one. – user2389977 Mar 23 '20 at 09:48
  • listFiles() returns null for that path on Android 10. Check for null before use. Or better dont use that path. – blackapps Mar 23 '20 at 10:18