Failed to open descriptor file (android)

I got a similar issue on my Android 13 device, when targeting SDK 33.

After digging a little bit, it looks like Unreal can’t read files in /storage/emulated/0 because it the permissions it requests (READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE) serve a different purpose in Android 11+; it doesn’t allow access to this “sensible” storage.

So, in Android 11+, the other permission to request is MANAGE_EXTERNAL_STORAGE. It’s considered as a “dangerous” permission, so you need to do extra steps to enable it than just adding the permission to the manifest.

There’s the quick and easy solution to just have TargetSDK ≤ 30 in the Project Settings, which works because it ignores the updated storage permission rules for backwards-compatibility… But then you need to remember to set the Target SDK to the latest version when publishing to the Play Store. And you might have (really rare) surprises with Android’s backwards-compatibility when doing so.

If you’re determined to keep the Target SDK to the latest version, here goes a temporary solution if you can’t edit the engine source code:

  1. Go to Project Settings > Android, and add the android.permission.MANAGE_EXTERNAL_STORAGE permission
  2. Make sure AndroidFileServer is disabled (else, AFS will never start and you’ll be stuck)
  3. Deploy your app to your device in Unreal
  4. Once the app has launched, close it because it will furiously fail to get the descriptor file
  5. Open up a terminal and run the following command to actually enable access to files, and replace [PACKAGE] with the full package name of your app (like com.somestudio.insanegame)
    adb shell appops set --uid [PACKAGE] MANAGE_EXTERNAL_STORAGE allow
    
    Or, you can go to your phone’s settings app and manually enable the permission for “manage all files”.
  6. Reopen your app and relieve

This solution is even less ideal because you have to remember to remove the android.permission.MANAGE_EXTERNAL_STORAGE permission when publishing to the Play Store. However, you can fix this problem entirely without any extra steps by editing the engine source code, or by making a UPL plugin which automates some of the stuff…

This issue really needs to be fixed in later UE versions, the fix is really just one permission and one adb command.

13 Likes