CRASH: Attempt to invoke virtual method 'android.content.res.XmlResourceParser
See original GitHub issue- I have verified there are no duplicate active or recent bugs, questions, or requests
Include the following:
- FishBun version:
0.8.6
- Device OS version:
7.0
- Device Manufacturer:
Samsung
- Device Name:
Galaxy S6 Edge
Reproduction Steps
- Try to take a picture in a FishBun instance initialized with the following code:
private fun loadImagePicker() {
FishBun.with(this)
.setImageAdapter(PicassoAdapter())
.setIsUseDetailView(false)
.setActionBarColor(
ResourcesCompat.getColor(resources, R.color.colorPrimary, null),
ResourcesCompat.getColor(resources, R.color.colorPrimaryDark, null),
true
)
.setActionBarTitleColor(ResourcesCompat.getColor(resources, R.color.colorAccent, null))
.setActionBarTitle(getString(R.string.reference_details_image_picker_title))
.setButtonInAlbumActivity(true)
.setCamera(true)
.startAlbum()
}
- Crash with the following exception:
Fatal Exception: java.lang.NullPointerException
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
android.support.v4.content.FileProvider.parsePathStrategy (FileProvider.java:591)
android.support.v4.content.FileProvider.getPathStrategy (FileProvider.java:565)
android.support.v4.content.FileProvider.getUriForFile (FileProvider.java:403)
**com.sangcomz.fishbun.util.CameraUtil.takePicture (CameraUtil.java:41)**
com.sangcomz.fishbun.ui.picker.PickerController.takePicture (PickerController.java:38)
com.sangcomz.fishbun.adapter.view.PickerGridAdapter$1.onClick (PickerGridAdapter.java:70)
android.view.View.performClick (View.java:6199)
android.view.View$PerformClick.run (View.java:23647)
android.os.Handler.handleCallback (Handler.java:751)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6682)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)
There seems to be an issue with FileProvider configuration. Note that I have the following in my manifest to configure my own FileProvider for sharing PDF files I generate in my app:
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths"
tools:replace="android:resource" />
</provider>
Expected Result
A picture taken
Actual Result
The exception above.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top 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 >Error: Attempt to invoke virtual method 'android.content.res ...
Error: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm. ... I tried once more and finally got it work.
Read more >FileProvider crash bug on Android 7.0 [37132906]
Android version : Android 7.0 device : one plus 3T crash log : Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.
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 >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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK thanks I will try that and let you know.
Oh yes, sorry, it worked perfectly. Thanks a lot . You can close it.