Search code examples
androidapk

Install two versions of an apk (with different applicationIds)


How much do I have to change in an android project for it to be installed as a new app?

I thought that it would be enough to change the applicationId in the build.gradle file, but I am not able to install the second version of the app without uninstalling the first version. In the play store I get error 910 or error -505 and when installing it manually I get:

Installation failed with message Failed to finalize session : INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/net.mindlevel-1: Can't install because provider name net.mindlevel (in package net.mindlevel) is already used by net.veglevel. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

Do I have to change the package name in AndroidManifest.xml too?

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.mindlevel">

And if I have change that, I have to change every single source file to use that package right?


Solution

  • In your manifest, there is a <provider> element with a hardcoded android:authorities attribute. That needs to be changed as well as your applicationId, as there can only be one provider installed for each unique authority.