question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NPE invoking ProviderInfo.loadXmlMetaData(PackageManager, String)

See original GitHub issue

Goal: capture image via camera. Device: Google Nexus 6P OS: Android 7.1.1, API 25

Exception at line #95.

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
                                                                       at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:583)
                                                                       at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:557)
                                                                       at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:399)
                                                                       at com.kbeanie.multipicker.core.ImagePickerImpl.takePictureWithCamera(ImagePickerImpl.java:144)
                                                                       at com.kbeanie.multipicker.core.ImagePickerImpl.pick(ImagePickerImpl.java:120)
                                                                       at com.kbeanie.multipicker.api.CameraImagePicker.pickImage(CameraImagePicker.java:74)

Any clues are greatly appreciated.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
coomar2841commented, Dec 14, 2016

Can you try this? Create a class extending FileProvider. And use that class name here? If that solves the issue for you, I will update the library to use a custom FileProvider.

0reactions
FreelancerAnkitcommented, Jul 31, 2018

Hey… i think you should check out the Package name provided in parser if you are using like following

           Uri photoURI = FileProvider.getUriForFile(AddExpensesActivity.this, "co.dsthub.abc.fileprovider", photoFile);

Check if package name matches with yours

Read more comments on GitHub >

github_iconTop Results From Across the Web

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:
Read more >
[SOLVED]Error at Taking picture with intents(Need Serious ...
ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference at android.support.v4.content.
Read more >
Exception when running on a real device with Android custom ...
NullPointerException : Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData( ...
Read more >
Xamarin Droid using FileProvider.GetUriForFile - Microsoft Q&A
ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference\n at Java.Interop.
Read more >
Delphi 10.4.1 on Android error : java.lang.NullPointerException
ProviderInfo.loadXmlMetaData (android.content.pm.PackageManager, java.lang.String)” only on “release” version of your application, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found