FileProvider error onHuawei devices

前端 未结 4 2144
予麋鹿
予麋鹿 2021-01-31 02:27

I have an exception that happens only on Huawei devices in my app when using FileProvider.getUriForFile:

Exception: java.lang.Illeg         


        
4条回答
  •  庸人自扰
    2021-01-31 03:17

    My solution to this issue right now, even if it's not perfect, is to declare my FileProvider with the following path (to be able serve all files on the device):

    
    
        
    
    

    This is not officially documented and might break with a future version of the v4 Support library but I can't see any other solution to serve a file in the secondary external storage (often the SD card) using the existing FileProvider.

提交回复
热议问题