FileProvider crash - npe attempting to invoke XmlResourceParser on a null String

前端 未结 9 1896
误落风尘
误落风尘 2020-11-28 21:38

This is a part of my manifest:




        
9条回答
  •  佛祖请我去吃肉
    2020-11-28 21:47

    The problem was that in Manifest I had this line:

    android:authorities="com.example.asd.fileprovider"
    

    and when calling getUriForFile I was passing:

    Uri contentUri = FileProvider.getUriForFile(getApplicationContext(), "com.example.asd", newFile); 
    

    So changed from "com.example.asd" to "com.example.asd.fileprovider" and it worked

提交回复
热议问题