Athul Antony
Athul Antony

Reputation: 220

java.lang.SecurityException: Failed to find provider questions for user 0; expected to find a valid ContentProvider

I am using se.emilsjolander:sprinkles:1.3.1 library for saving data to my database. When I upgraded to oreo sdk 26, getting an error saying that there should be a valid content provider. I didn't get how to implement it with my library. Can anybody make this clear for me? I am adding the stack here.

 java.lang.SecurityException: Failed to find provider questions f user 0; expected to find a valid ContentProvider for this authority 10-31

Upvotes: 1

Views: 3212

Answers (1)

Virginia Woolf
Virginia Woolf

Reputation: 1268

Before API level 26, you could provide a stub ContentProvider with no functionality, now some minimal functionality is mandatory. See https://developer.android.com/about/versions/oreo/android-8.0-changes.html#ccn

Android 8.0 (API level 26) changes how ContentResolver.notifyChange() and registerContentObserver(Uri, boolean, ContentObserver) behave for apps targeting Android 8.0.

These APIs now require that a valid ContentProvider is defined for the authority in all Uris. Defining a valid ContentProvider with relevant permissions will help defend your app against content changes from malicious apps, and prevent you from leaking potentially private data to malicious apps.

Upvotes: 1

Related Questions