Someone else used the same provider authority as you. AFAIK, that's the only way this error can occur. What did you choose as your provider authority?


This happens only on Lollipop 5.0.1 devices . It only happens if you have not declared applicationId on your build.gradle. This is due to play-service-measurement using applicationId parameter.

declare applicationId "com.your.package" on your gradle


The app is the only one that absolutely needs to know about the authority, as it is the one that declares the <provider> in the manifest with the android:authorities attribute.

Hence, in principle, it should "just work", so long as you remove all authority-specific logic from the provider, such as:

  • those static data members (which now move to the hosting app)
  • UriMatcher (roll something yourself that does not examine the authority, but focuses on the rest of the Uri)

If, for some reason, you are absolutely sure that your provider needs to know its authority, then the app will have to supply that to the provider before the provider is used for real work. Possible ways to do that include:

  • Since a ContentProvider is a natural singleton, assign it to a static data member, and then supply the authority string to it by a custom method from a custom Application class (as providers are initialized first, so this should work)

  • If you are only supporting API Level 11+, have the custom Application class use call() on ContentResolver to supply the authority to the ContentProvider

  • Assume that the only real calls (e.g., to query()insert()) are valid, and just lazy-initialize your authority based on what comes in on the first Uri you see

faced the same issue. I then checked the full manifest as suggested in the comment above by Commonsware. My full manifest was having a provider but as it was merged from play-service-measurement library module, so at first glance it looked okay to me.

But actually it had the issue due to its authority. This provider has correctly declared its authorities attribute in its manifest with ${applicationId} placeholder as a prefix. But due to a bug in build system, if app's build.gradle does not has any applicationId then this placeholder is being replaced by library's package name instead of our app's package name. It may result in multiple apps having same authority for this provider. Here is a link for this issue.

As a workaround, we can just declare an applicationId in our build.gradle, which can be kept same as package name in manifest in most cases. In case you want to keep different values for these two, you can read further about the differences between manifest's package name and build.gradle's applicationId.