Jerome
Jerome

Reputation: 1759

Android: Failed to ensure directory when getExternalFilesDir(null)

As shown in the title, when I called the method getExternalFilesDir(null), i got a warning like this: Failed to ensure directory: /storage/emulated/0/Android/data/com.xxxx.app/files

So, it turns out that the i cannot get the path /storage/emulated/0/Android/data/com.xxxx.app/files Also, the problem only happens sometimes.

Upvotes: 9

Views: 8504

Answers (2)

Chakir
Chakir

Reputation: 478

This happened to me when uninstalling the app and reinstalling it. But probably the resources of the app (com.xxxx.app in your case) had a reference not released.

The solution was quite simple: just stop and relaunch the emulator, or reboot the phone should do the trick.

Upvotes: 2

trethaller
trethaller

Reputation: 587

This is because you are connected to your development machine, and cannot write to the emulated storage on it.

Upvotes: -1

Related Questions