Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #137

Open
vinaydahiwale opened this issue Dec 19, 2017 · 3 comments

Comments

@vinaydahiwale
Copy link

12-19 10:45:25.323 22792-22792/com.kotak.aof E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kotak.aof, PID: 22792
java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=0, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.kotak.aof/com.kotak.aof.MainActivity}: 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.app.ActivityThread.deliverResults(ActivityThread.java:3720)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3763)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1403)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: 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.b(SourceFile:584)
at android.support.v4.content.FileProvider.a(SourceFile:558)
at android.support.v4.content.FileProvider.a(SourceFile:400)
at org.apache.cordova.camera.CameraLauncher.takePicture(SourceFile:295)
at org.apache.cordova.camera.CameraLauncher.onRequestPermissionResult(SourceFile:1315)
at org.apache.cordova.CordovaInterfaceImpl.onRequestPermissionResult(SourceFile:214)
at org.apache.cordova.CordovaActivity.onRequestPermissionsResult(SourceFile:508)

@axper
Copy link

axper commented Jun 12, 2018

Same problem here.

@iad24
Copy link

iad24 commented Jun 20, 2018

Another one here

@axper
Copy link

axper commented Jun 20, 2018

@iad24 I found a workaround/solution:

  1. Create an empty Java CustomFileProvider class inheriting from file provider:
package your.project.utils;

import android.support.v4.content.FileProvider;


public class CustomFileProvider extends FileProvider {
}

  1. In your AndroidManifest.xml change the provider to use this new provider:

     <provider
         android:name=".utils.CustomFileProvider"
         android:authorities="${applicationId}.fileprovider"
         android:exported="false"
         android:grantUriPermissions="true">
         <meta-data
             android:name="android.support.FILE_PROVIDER_PATHS"
             android:resource="@xml/file_paths" />
     </provider>
    

This way both your provider and EasyImage's provider will be able to coexist peacefully.
Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants