0

I tried to uninstall dynamic feature module, but the module still exists. No error appears during the uninstallation process. This is my configuration on module :

  <dist:module
        dist:instant="false"
        dist:title="@string/title_komunitas">
        <dist:delivery>
            <dist:on-demand />
        </dist:delivery>
        <dist:fusing dist:include="true" />
    </dist:module>

The function below is to uninstall the module:

private lateinit var manager: SplitInstallManager

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setTitle(R.string.app_name)
        setContentView(R.layout.activity_main)
        manager = SplitInstallManagerFactory.create(this)
        initializeViews()
    }

private fun requestUninstall() {
        toastAndLog("Requesting uninstall of all modules." +
                "This will happen at some point in the future.")

        val installedModules = manager.installedModules.toList()
        manager.deferredUninstall(installedModules).addOnSuccessListener {
            toastAndLog("Uninstalling $installedModules")
        }.addOnFailureListener {
            toastAndLog("Failed installation of $installedModules")
        }
    }

After the uninstall, I check if the module still exists or not using this function:

private fun checkModuleInstalled() {
    toastAndLog("Installed module ${manager.installedModules}")
}
Sweta Jain
  • 3,248
  • 6
  • 30
  • 50
  • did you find the solution? I'm facing the same issue, tried everything but the module shows as existing everytime. – Pooja Singh Mar 09 '22 at 13:05

1 Answers1

1

I'm a bit late to the party, but you have to keep in mind two things:

first, you need to set

    <dist:removable dist:value="true"></dist:removable>

Otherwise, you won't be able to remove it later.

Second, according to the docs, uninstall means

In addition, your app can request to uninstall features at a later time

It may take up to 24 hours until the feature gets removed automatically from the phone.

Dennis Allert
  • 580
  • 1
  • 9
  • 8