FileProvider error

前端 未结 3 1744
无人共我
无人共我 2020-12-29 10:23

https://developer.android.com/training/camera/photobasics.html

All I am trying to do is take a picture with the Camera, save it and display it in an ImageView.

3条回答
  •  被撕碎了的回忆
    2020-12-29 10:37

    I finally got it to work!

    Remember to put the provider tag INSIDE the application tag in the manifest file - that was my mistake (my provider tag was OUTSIDE of the application tag), and the reason you get this error, which basically says it cannot find the definition of the Provider.

    Also make sure you have the correct paths in the .xml file. Here is my version:

    
    
    
        
    
    
    

    Of course you have to change the path for your own application.

    My actual Provider then looks like this:

    
    
        
    
    
    

    Again, you'll need to change the authorities value in your own application.

    You can see all the source at the GitHub repository from my original question.

提交回复
热议问题