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

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

Leave a Comment