ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" after androidx migration
Thanks to @CommonsWare
More explanation:
What to do, find the android.support.v4.FileProvider
in your <provider>
in AndroidManifest.xml
.
Change it to androidx.core.content.FileProvider
In manifiest.xml file simply change this
<provider
android:name="android.support.v4.content.FileProvider"
.....
</provider>
To this one
<provider
android:name="androidx.core.content.FileProvider"
......
</provider>
Or Simply
- Go to Refactor (Studio -> Menu -> Refactor)
- Click the Migrate to AndroidX.
- it's working.
why does it want to load the old version of FileProvider?
Based on the stack trace, perhaps you are still using the old package name in the <provider>
element in the manifest.