ClassNotFoundException: Didn't find class “android.support.v4.content.FileProvider” after androidx migration

后端 未结 3 996
梦谈多话
梦谈多话 2021-01-01 08:27

I\'m trying to move to migrate to androidx. I used the migration tool in Android Studio. When I do this I get the following stacktrace when I run my app.

E/A         


        
相关标签:
3条回答
  • 2021-01-01 08:48

    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.
    0 讨论(0)
  • 2021-01-01 08:50

    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

    0 讨论(0)
  • 2021-01-01 08:51

    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.

    0 讨论(0)
提交回复
热议问题