androidandroid-app-bundledynamic-featuredynamic-delivery

Getting SplitInstallErrorCode.MODULE_UNAVAILABLE for dynamic module


I am getting the following error SplitInstallErrorCode.MODULE_UNAVAILABLE trying to install a dynamic module. I am already using Google play internal app sharing to test the aab file but still getting it.

Here is the dynamic feature manifest file:

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

Here is how I'm starting the download:

private val moduleInvestment by lazy { getString(R.string.module_investment) }

splitInstallRequest = SplitInstallRequest
                        .newBuilder()
                        .addModule(moduleInvestment)
                        .build()

     splitInstallManager.startInstall(splitInstallRequest)
                    .addOnSuccessListener { sessionId -> mySessionId = sessionId }
                    .addOnFailureListener { exception ->
                        when ((exception as SplitInstallException).errorCode) {
                            SplitInstallErrorCode.NETWORK_ERROR -> {

                            }
                            SplitInstallErrorCode.ACTIVE_SESSIONS_LIMIT_EXCEEDED ->
                                checkForActiveDownloads()
                            SplitInstallErrorCode.MODULE_UNAVAILABLE ->
                                Toast.makeText(
                                        requireActivity(),
                                        "You don't have access to $moduleInvestment module",
                                        Toast.LENGTH_LONG).show()
                        }
                    }

How can I solve this issue?


Solution

  • The value you pass in SplitInstallRequest should not be the title of the dynamic feature module but its name. The name of the dynamic feature module is also the name of the Gradle module, which you also set in the Gradle configuration android.dynamicFeatures.

    Hope that helps,