【发布时间】:2019-09-26 15:40:55
【问题描述】:
我有一个 android 应用程序,我想从 Instant App 安装一个新模块。我正在使用SplitInstallManager这样做。
请求安装后,我收到一个 SplitInstallSessionStatus.FAILED 错误代码 = -100。根据android文档,错误代码-100是一个内部错误。 (https://developer.android.com/reference/com/google/android/play/core/splitinstall/model/SplitInstallErrorCode)
这是一个模块化的安卓应用程序。我有多个模块(大约十个),但只有一个启用即时应用程序的模块和一个启用了 onDemand 的模块(我正在尝试安装的那个)
fun installAndLaunchPlayer(manager: SplitInstallManager, videoId: String) {
var mySessionId = 0
if (manager.installedModules.contains("player")) {
_onPlayerInstalledSuccessful.value = videoId
return
}
val request = SplitInstallRequest.newBuilder()
.addModule("player")
.build()
manager.registerListener(object : SplitInstallStateUpdatedListener {
override fun onStateUpdate(state: SplitInstallSessionState) {
if (state.status() == SplitInstallSessionStatus.FAILED && state.errorCode() == SplitInstallErrorCode.SERVICE_DIED) {
// Retry the request.
return
}
if (state.sessionId() == mySessionId) {
when (state.status()) {
SplitInstallSessionStatus.DOWNLOADING -> {
}
SplitInstallSessionStatus.INSTALLED -> {
_onPlayerInstalledSuccessful.value = videoId
}
SplitInstallSessionStatus.FAILED -> {
// HERE IS WHERE I GET THE ERROR CODE = -100
state.errorCode()
_onPlayerInstalledFailure.value = "failed to install module"
}
}
}
}
})
manager
.startInstall(request)
.addOnSuccessListener { mySessionId = it }
.addOnFailureListener {
_onPlayerInstalledFailure.value = it.message
}
}
除了在安装请求开始时收到的SplitInstallSessionStatus.PENDING 之外,我从未收到任何其他SplitInstallSessionStatus.FAILED。
这是错误日志:
SplitInstallSessionState{sessionId=42, status=6, errorCode=-100, bytesDownloaded=0, totalBytesToDownload=0, moduleNamesNullable=[player], languagesNullable=null, resolutionIntent=null, splitFileIntents=null}
你能帮帮我吗?
【问题讨论】:
标签: android android-instant-apps