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.

Runtime error: Attempt to invoke virtual method 'android.content.res.XmlResourceParser

See original GitHub issue

I’m getting the following error when using version 1.0.24 (after adding the provider). Did anyone face this? (it was working with the previous version…)

10x!!!

Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.PackageItemInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference parsePathStrategy FileProvider.java:583 getPathStrategy FileProvider.java:557 getUriForFile FileProvider.java:399 getURI ShareFile.java:135 open ShareIntent.java:49 open GenericShare.java:18 open RNShareModule.java:50 invoke Method.java invoke JavaMethodWrapper.java:374 invoke JavaModuleWrapper.java:162 run NativeRunnable.java handleCallback Handler.java:751 dispatchMessage Handler.java:95 dispatchMessage MessageQueueThreadHandler.java:31 loop Looper.java:154 run MessageQueueThreadImpl.java:194 run Thread.java:761

Issue Analytics

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

github_iconTop GitHub Comments

8reactions
EyalSicommented, Jan 21, 2018

Rebuild solved this one. For those coming from version 1.0.23 to 1.0.24, you need to:

  1. Add to .\android\app\src\main\AndroidManifest.xml, in <application> section:
<provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="${applicationId}.provider"
  android:grantUriPermissions="true"
  android:exported="false">
</provider>
  1. Add to .\android\app\src\main\java\com\anashim\MainApplication.java (you already added the package when you installed this):
import cl.json.ShareApplication;
...
public class MainApplication extends Application implements ReactApplication, ShareApplication  {
...
  @Override
  public String getFileProviderAuthority() {
         return "${applicationId}.provider";
  }  
2reactions
filipef101commented, Feb 8, 2018

I had to put on main application part the package name hardcode and with an if debug since my debug package name ends in .debug and in manifest left it fetching from graddle and no issue, after all I wasn’t sharing a base64, and 1.0.23 doesn’t work on andoird Oreo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Attempt to invoke virtual method 'android.content.res ...
loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference #598.
Read more >
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 >
Fixed Error android error attempt to invoke virtual method
Need Help or Code Support? Feel Free To Contact Us Here http://www.aaviskar.com/support.phpThis video is about Fixed Error android error ...
Read more >
attempt to invoke virtual method react native - You.com
I get this error when I try to run my App. There are no errors in Android Studio,Server and on running react-native run-android....
Read more >
Delphi 10.4.1 on Android error : java.lang.NullPointerException
When you try to use the camera component and you get “java.lang.NullPointerException: Attempt to invoke virtual method” only on “release” ...
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