Michael Paccione
Michael Paccione

Reputation: 2827

Unresolved Class 'FileProvider' in manifest.xml (Android Java)

I am building my first Java application. Its functionality includes taking camera images and saving them along with saving 'Project' information locally for said images to be associated with.

I believe I need to include the FileProvider to my code:

        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="devkit.blade.vuzix.com.blade_template_app"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_path"></meta-data>
        </provider>

In the above XML .FileProvider is not resolving and so I cant build the app. What's the problem here?

Also for context @xml/provider_path references this file:

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-path name="/storage/emulated/0" path="."/>
</paths>

Upvotes: 0

Views: 774

Answers (2)

Michael Paccione
Michael Paccione

Reputation: 2827

Adding this to my build.grade (app module) allowed it to be referenced correctly. If you are required to use API level 27 (pre androidX) this is the way!

implementation 'com.android.support:support-core-utils:27.0.0'

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007399

I believe I need to include the FileProvider to my code

In your <provider> element in your manifest, try changing android.support.v4.content.FileProvider (the fully-qualified class name to an old edition of FileProvider) to androidx.core.content.FileProvider.

Upvotes: 1

Related Questions