nguyenhoanglam / ImagePicker

A customizable library for selecting images on the device.
Apache License 2.0
599 stars 156 forks source link

Getting crash when clicking on camera button #84

Closed manishandroid closed 4 years ago

manishandroid commented 6 years ago

Below is crash details from crashlytics:

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 at android.support.v4.content.FileProvider.parsePathStrategy(SourceFile:3591) at android.support.v4.content.FileProvider.getUriForFile(SourceFile:403) at com.nguyenhoanglam.imagepicker.ui.camera.DefaultCameraModule.getCameraIntent(SourceFile:33) at com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerActivity.com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerPresenter.captureImage(SourceFile:20080) at com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerActivity.access$800(SourceFile:41) at com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerActivity$8.onPermissionGranted(SourceFile:257) at com.nguyenhoanglam.imagepicker.helper.PermissionHelper.checkPermission(SourceFile:34) at com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerActivity.captureImageWithPermission(SourceFile:24234) at com.nguyenhoanglam.imagepicker.ui.imagepicker.ImagePickerActivity$4.onClick(SourceFile:81) at android.view.View.performClick(View.java:5640) at android.view.View$PerformClick.run(View.java:22455) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6165) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

horelvis commented 6 years ago

I have the same issue! Do any solution?

horelvis commented 6 years ago

The solution is add a provider in AndroidManifest.xml

<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/provider_paths"
                tools:replace="android:resource"/>
        </provider>
nguyenhoanglam commented 4 years ago

Hi @manishandroid @horelvis , Version 1.4.0 is now available! Please read What's new and check if your issue has been fixed!