Search code examples
androidandroid-studiointellij-ideaandroid-contentprovider

Creating a ContentProvider in Android Studio 2.3.3


I'm using Android Studio 2.3.3 and was trying to add a Content Provider component to the project. I keep getting the error "URI Authorities must be a valid URI authority" even after trying many variants of the URI Authorities entry. Same results for a brand new project shown below. Is this working in Studio or is something wrong with the entry?

Android Studio Configure Component


Solution

  • It should be without content:// prefix, as simple as com.package.1;com.package.2:

    enter image description here

    This will create following <provider> in AndroidManifest:

        <provider
            android:name="com.mydomain.MyContentProvider"
            android:authorities="com.example.1;com.example.2"
            android:enabled="true"
            android:exported="true"></provider>