8

I am trying to test the FileProvider tutorial.

It asks to include in the manifest :

<provider
    android:name="android.support.v4.content.FileProvider"
    android:authorities="com.mydomain.fileprovider"
    android:exported="false"
    android:grantUriPermissions="true">
</provider>

In the manifest, I get the error:

 Cannot resolve symbol FileProvider

I followed these instructions, to add the v4 support library to Android Studio. I add the following to the build.gradle file, but the gradle sync fails :

 compile "com.android.support:support-v4:18.0.+"

What must I do to resolve this problem ?

Andrey Korneyev
  • 26,353
  • 15
  • 70
  • 71
Jake
  • 16,329
  • 50
  • 126
  • 202

3 Answers3

2

Go to File > Invalidate Caches / Restart and Invalidate and Restart.

Abhishek Balani
  • 3,827
  • 2
  • 24
  • 34
2

I believe the version of the support library you are targeting (18.0.+) is too low. FileProvider was only added in version 22.1.0 according to the reference docs so you will need at least:

compile "com.android.support:support-v4:22.1.0"
LordParsley
  • 3,808
  • 2
  • 30
  • 41
1

I know this too late in case you got same problem please refer

https://stackoverflow.com/a/58784995/5193899

<provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="com.camera.app.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_paths">

        </meta-data>
    </provider>
Joseph Ali
  • 345
  • 1
  • 5
  • 11