android – I am getting split error install when download the module-ThrowExceptions

Exception or error:

i used app bundle for dynamic download code when required while downloading code i am getting issue. Below is code

SplitInstallRequest request =
            SplitInstallRequest
                    .newBuilder()
                    // You can download multiple on demand modules per
                    // request by invoking the following method for each
                    // module you want to install.
                    .addModule("feature2")
                    .build();

    // Begin the installation of the feature1 module and handle success/failure
    splitInstallManager
            .startInstall(request)
            .addOnSuccessListener(new OnSuccessListener<Integer>() {
                @Override
                public void onSuccess(Integer integer) {
                    // Module download successful
                    Intent intent = new Intent().setClassName(getPackageName(), "com.bapspatil.feature2.FeatureTwoActivity");
                    startActivity(intent);
                }
            })
            .addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(Exception e) {
                    // Module download failed; handle the error here
                    Toast.makeText(getApplicationContext(), "Couldn't download feature2: " + e.getMessage(), Toast.LENGTH_LONG).show();
                }
            });
How to solve:

Edit:

There is now a FakeSplitInstallManager that can be used to simulate the installation of dynamic feature modules. It does require a code change (i.e. swapping the SplitInstallManager for the fake) for the time being, but it also allows you to also test scenarios such as network failure.


Today, the download of dynamic feature modules cannot be done from apps installed from Android Studio (or Gradle).

The download of dynamic feature modules can be tested in two ways:

  • Internal App Sharing: requires the app to be published in the store, but then you can upload bundles quickly (without changing the versionCode or even signing them) and you get a link you can open on the phone which installs the app.

  • Internal test track: this method doesn’t require a published app and serves the app immediately on the device of whitelisted accounts, but this is a release track so you need a signed App Bundle with a higher versionCode.

Leave a Reply

Your email address will not be published. Required fields are marked *