I am attempting to white label my app by changing my Android Application Project into an Android Library Project and then importing the library into a new Android Application Project.
I am running into a problem with the fact that my app (read: Library Project) contains a ContentProvider.
When I attempt to install my new Android Application Project onto an emulator, console tells me:
[2014-01-24 13:35:39 - WhitelabelTest] Installation error: INSTALL_FAILED_CONFLICTING_PROVIDER
[2014-01-24 13:35:39 - WhitelabelTest] Please check logcat output for more details.
[2014-01-24 13:35:39 - WhitelabelTest] Launch canceled!
According to the logcat:
01-24 13:38:52.217: W/PackageManager(58): Can't install because provider name com.myapp.app.db.providers.MyProvider (in package com.example.whitelabeltest) is already used by com.myapp.app
01-24 13:38:52.227: W/PackageManager(58): Package couldn't be installed in /data/app/com.example.whitelabeltest-2.apk
Does this simply mean you cannot have both applications installed on the same device because they use the same ContentProvider? Or is there a way around this? Do I need to create a new ContentProvider in my new Android Project with a new name instead?
Here is the Provider as listed in my WhitelabelTest project's Manifest:
<provider
android:name="com.myapp.app.db.providers.MessagesProvider"
android:authorities="com.myapp.app.db.providers.MessagesProvider"
android:exported="false" />
I attempted to change the name parameter with the same result.
You cannot have both applications installed on the same device because they both attempt to declare the same authority (in
android:authorities) in a<provider>. There can only be one provider for a given authority.This is similar to how you cannot have two apps installed with the same
package.I'd start by considering whether a
ContentProvideris necessary, and perhaps drop it if it is not.Otherwise, the implementation of the
ContentProvidercan be the common one from the library project. However, theandroid:authoritiesmust be unique, and therefore any clients of thatContentProviderneed to know the right authority to use to reach the right provider.