ImagePicker icon indicating copy to clipboard operation
ImagePicker copied to clipboard

Fix NPE when using ImagePicker as library

Open songpr opened this issue 7 years ago • 2 comments

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

songpr avatar Feb 23 '18 02:02 songpr

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>

prazjain avatar Aug 02 '18 21:08 prazjain

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

songpr avatar Nov 07 '18 07:11 songpr