Mariovc / ImagePicker

Android library to easily pick an image from gallery or camera app. The users can select their prefered gallery/camera app on a unique Intent. Initial gist:
https://gist.github.com/Mariovc/f06e70ebe8ca52fbbbe2
Apache License 2.0
158 stars 52 forks source link

Fix NPE when using ImagePicker as library #46

Closed songpr closed 2 years ago

songpr commented 6 years ago

The authorities will be not match since application id will match the project package not com.mvc.imagepicker

prazjain commented 6 years ago

This is how i resolved it :

    <!-- NullPointerException in Android>24 for ImagePicker without this setting below -->
    <provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.mvc.imagepicker.provider"
        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>

And filepaths.xml is :


<paths>
    <external-path name="external_files" path="."/>
</paths>
songpr commented 6 years ago

For workaround while waiting for official fix use below code in build.gradle instead the official one. implementation 'com.github.songpr:ImagePicker:e2b4383'