[Bug report] Android Firebase Remote Model Download Issues
kts6056 opened this issue · comments
Describe the bug
The following runtime error occurs for some users.
Fatal Exception: com.google.android.gms.tasks.RuntimeExecutionException: com.google.mlkit.common.MlKitException: Hash does not match with expected
at com.google.android.gms.tasks.zzw.getResult(com.google.android.gms:play-services-tasks@@18.0.2:2)
at com.google.mlkit.common.internal.model.zzf.onComplete(com.google.mlkit:common@@18.10.0:4)
at com.google.android.gms.tasks.zzj.zza(zzj.java:13)
at com.google.android.gms.tasks.zzi.run(com.google.android.gms:play-services-tasks@@18.0.2:1)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by com.google.mlkit.common.MlKitException: Hash does not match with expected
at com.google.mlkit.common.sdkinternal.model.RemoteModelFileManager.moveModelToPrivateFolder(com.google.mlkit:common@@18.10.0:23)
at com.google.mlkit.common.sdkinternal.model.RemoteModelDownloadManager.zzi(com.google.mlkit:common@@18.10.0:6)
at com.google.mlkit.common.sdkinternal.model.RemoteModelDownloadManager.isModelDownloadedAndValid(RemoteModelDownloadManager.java:10)
at com.google.mlkit.common.internal.model.zzg.zza(zzg.java:1)
at com.google.mlkit.common.internal.model.zze.call(com.google.mlkit:common@@18.10.0:88)
at com.google.mlkit.common.sdkinternal.zzf.run(com.google.mlkit:common@@18.10.0:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.os.HandlerThread.run(HandlerThread.java:67)
To Reproduce
- When downloading a model from firebase
private val modelManager by lazy { RemoteModelManager.getInstance() }
val firebaseModelSource = FirebaseModelSource.Builder(modelName).build()
val remoteModel = CustomRemoteModel.Builder(firebaseModelSource).build()
modelManager.isModelDownloaded(remoteModel)
.continueWithTask { task ->
runCatching {
modelManager.download(
remoteModel,
DownloadConditions.Builder()
.apply { if (task.result == true) requireWifi() }
.build()
)
}.getOrNull()
}
.addOnSuccessListener {
runCatching {
ImageLabeling.getClient(
CustomImageLabelerOptions
.Builder(remoteModel)
.setConfidenceThreshold(0.0f)
.build()
)
}
}
SDK Info:
google-mlkit-imageLabeling = { group = "com.google.mlkit", name = "image-labeling-custom", version = "17.0.2" }
google-mlkit-linkFirebase = { group = "com.google.mlkit", name = "linkfirebase", version = "17.0.0" }
The error Hash does not match with expected
means the downloaded model file doesn't match the expected hash.
Could you re-host the model from firebase console to see if it works?
The error
Hash does not match with expected
means the downloaded model file doesn't match the expected hash.Could you re-host the model from firebase console to see if it works?
The download works well for most users, but it only happens to a small number of users.
Do you think there is a problem with the model file you uploaded?
Probably. You can try re-upload the model file to see if this issue still exists, or experiment with another model file to see whether it has the same issue.
Close this issue now.
Feel free to re-open it if you have any more issues. Thanks!