下载模块时出现拆分错误安装
I am getting split error install when download the module
我在下载代码时遇到问题,需要时使用应用程序包动态下载代码。下面是代码
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();
}
});
编辑:
现在有一个FakeSplitInstallManager可以用来模拟动态功能模块的安装。它暂时确实需要更改代码(即将 SplitInstallManager
换成假的),但它还允许您测试网络故障等场景。
现在,无法从 Android Studio(或 Gradle)安装的应用程序下载动态功能模块。
动态特性模块的下载可以通过两种方式进行测试:
Internal App Sharing:要求应用程序在商店中发布,但您可以快速上传捆绑包(无需更改版本代码甚至签名)并且您会获得 link 您可以在安装应用程序的 phone 上打开。
Internal test track:此方法不需要已发布的应用程序并立即在白名单帐户的设备上提供该应用程序,但这是一个发布轨道,因此您需要一个已签名的应用程序包使用更高版本代码。
我在下载代码时遇到问题,需要时使用应用程序包动态下载代码。下面是代码
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();
}
});
编辑:
现在有一个FakeSplitInstallManager可以用来模拟动态功能模块的安装。它暂时确实需要更改代码(即将 SplitInstallManager
换成假的),但它还允许您测试网络故障等场景。
现在,无法从 Android Studio(或 Gradle)安装的应用程序下载动态功能模块。
动态特性模块的下载可以通过两种方式进行测试:
Internal App Sharing:要求应用程序在商店中发布,但您可以快速上传捆绑包(无需更改版本代码甚至签名)并且您会获得 link 您可以在安装应用程序的 phone 上打开。
Internal test track:此方法不需要已发布的应用程序并立即在白名单帐户的设备上提供该应用程序,但这是一个发布轨道,因此您需要一个已签名的应用程序包使用更高版本代码。