【已解决】 MlKit:Failed to load deprecated vision dynamite module.
跑的官方案例也出现了这个错误,不知道怎么解决:
在接入mlkit 的时候,出现了如下的错误:
MlKitException:Failed to load deprecated vision dynamite module.
有没有大哥遇到过啊,下面是我找到的一个答案,但是不知道怎么解决
MlKitException Failed to load deprecated vision dynamite module | Evil Mouth
private fun recognizeTextOnDevice(
image: InputImage
): Task<com.google.mlkit.vision.text.Text> {
return detector.process(image)
.addOnSuccessListener { visionText ->
result.value = visionText.text
}
.addOnFailureListener { exception ->
LogUtil.w("-----------识别失败 $exception")
Log.e(TAG, "Text recognition error", exception)
val message = getErrorMessage(exception)
message?.let {
Toast.makeText(context, "$message", Toast.LENGTH_SHORT).show()
}
}
}
private fun getErrorMessage(exception: Exception): String? {
val mlKitException = exception as? MlKitException ?: return exception.message
return if (mlKitException.errorCode == MlKitException.UNAVAILABLE) {
"Waiting for text recognition model to be downloaded"
} else exception.message
}
已经告诉你加载不了一个过时的版本,那么你可以尝试去改一下版本,或者去官方文档里找找有没有相关的版本要求说明。