使用MLKIT条形码扫描仪的错误

发布于 2025-02-05 18:02:54 字数 3281 浏览 2 评论 0原文

我正在使用Firebase的条形码扫描仪,但是我总是会遇到三个错误,我不知道它们是否可以影响我的应用程序

Failed to open file '/data/data/com.example.veggystock/code_cache/.overlay/base.apk/assets/mlkit_barcode_models/barcode_ssd_mobilenet_v1_dmp25_quant.tflite': No such file or directory
Failed to open file '/data/data/com.example.veggystock/code_cache/.overlay/base.apk/assets/mlkit_barcode_models/oned_auto_regressor_mobile.tflite': No such file or directory
Failed to open file '/data/data/com.example.veggystock/code_cache/.overlay/base.apk/assets/mlkit_barcode_models/oned_feature_extractor_mobile.tflite': No such file or directory

我的代码以使用UPC处理图像是这样

        scanner.process(image)
            .addOnSuccessListener { barcodes ->
                for (barcode in barcodes) {
                    val rawValue = barcode.rawValue.toString()
                    Log.d("RAWVALUE ->>>", rawValue)

                    CoroutineScope(Dispatchers.IO).launch {
                        val apiCall = getRetrofit(urlBaseUpc).create(ApiService::class.java)
                            .foodDatabase("parser?app_id=$appIdDatabase&app_key=$appKeyDatabase&upc=$rawValue")
                        //&health=vegetarian
                        if (apiCall.isSuccessful) {
                            apiCallBody = apiCall.body()!!
                            if (apiCallBody.listHints.isNotEmpty()) {
                                apiCall2 =
                                    getRetrofit(urlBaseNutrition).create(ApiService::class.java)
                                        .foodAnalysis("nutrition-data?app_id=$appIdNutrition&app_key=$appKeyNutrition&ingr=${apiCallBody.listHints.first().food.id}")
                                //&nutrition-type=cooking
                                runOnUiThread {
                                    if (apiCall2.isSuccessful) {
                                        apiCall2Body = apiCall2.body()!!

                                        if (apiCall2Body.healthLabels.contains("VEGAN")) {
                                            alertBuilder(
                                                R.style.alertDialogPositive,
                                                "${apiCallBody.listHints.first().food.label} is Vegan"
                                            )
                                        } else {
                                            alertBuilder(
                                                R.style.alertDialogNegative,
                                                "${apiCallBody.listHints.first().food.label} is not Vegan"
                                            )
                                        }
                                    } else {
                                        Log.e("PROBLEM ->>", "API CALL NOT SUCCESFUL")
                                    }
                                }
                            } else {
                                alertNotFound()
                            }
                        }
                    }
                }
            }
            .addOnFailureListener {
                Log.e("PROBLEM ->>>>>>", "BARCODE NOT RECOGNIZED")
            }

I am using the barcode scanner from firebase which is working well, however I always get three errors and I don't know if at some moment they could affect my app

Failed to open file '/data/data/com.example.veggystock/code_cache/.overlay/base.apk/assets/mlkit_barcode_models/barcode_ssd_mobilenet_v1_dmp25_quant.tflite': No such file or directory
Failed to open file '/data/data/com.example.veggystock/code_cache/.overlay/base.apk/assets/mlkit_barcode_models/oned_auto_regressor_mobile.tflite': No such file or directory
Failed to open file '/data/data/com.example.veggystock/code_cache/.overlay/base.apk/assets/mlkit_barcode_models/oned_feature_extractor_mobile.tflite': No such file or directory

My code to process the image with the UPC is this

        scanner.process(image)
            .addOnSuccessListener { barcodes ->
                for (barcode in barcodes) {
                    val rawValue = barcode.rawValue.toString()
                    Log.d("RAWVALUE ->>>", rawValue)

                    CoroutineScope(Dispatchers.IO).launch {
                        val apiCall = getRetrofit(urlBaseUpc).create(ApiService::class.java)
                            .foodDatabase("parser?app_id=$appIdDatabase&app_key=$appKeyDatabase&upc=$rawValue")
                        //&health=vegetarian
                        if (apiCall.isSuccessful) {
                            apiCallBody = apiCall.body()!!
                            if (apiCallBody.listHints.isNotEmpty()) {
                                apiCall2 =
                                    getRetrofit(urlBaseNutrition).create(ApiService::class.java)
                                        .foodAnalysis("nutrition-data?app_id=$appIdNutrition&app_key=$appKeyNutrition&ingr=${apiCallBody.listHints.first().food.id}")
                                //&nutrition-type=cooking
                                runOnUiThread {
                                    if (apiCall2.isSuccessful) {
                                        apiCall2Body = apiCall2.body()!!

                                        if (apiCall2Body.healthLabels.contains("VEGAN")) {
                                            alertBuilder(
                                                R.style.alertDialogPositive,
                                                "${apiCallBody.listHints.first().food.label} is Vegan"
                                            )
                                        } else {
                                            alertBuilder(
                                                R.style.alertDialogNegative,
                                                "${apiCallBody.listHints.first().food.label} is not Vegan"
                                            )
                                        }
                                    } else {
                                        Log.e("PROBLEM ->>", "API CALL NOT SUCCESFUL")
                                    }
                                }
                            } else {
                                alertNotFound()
                            }
                        }
                    }
                }
            }
            .addOnFailureListener {
                Log.e("PROBLEM ->>>>>>", "BARCODE NOT RECOGNIZED")
            }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧情勿念 2025-02-12 18:02:54

这些资产/mlkit_barcode_models/*。tflite tensorflow Lite模型缺少。
如果它仍然检测到条形码,则可能是由于Playser-Services-Mlkit-Barcode-Scanning


a)用于将模型与您的应用程序捆绑(较大的软件包):

implementation 'com.google.mlkit:barcode-scanning:17.0.2'

b)用于使用Google Play服务中的模型(下载点播):

implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.0.0'

扫描条形码在Android上

These assets/mlkit_barcode_models/*.tflite TensorFlow Lite models are missing.
If it still detects barcode, this may be due to play-services-mlkit-barcode-scanning.


a) For bundling the models with your app (larger package):

implementation 'com.google.mlkit:barcode-scanning:17.0.2'

b) For using the models from Google Play Services (download on demand):

implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.0.0'

Source: Scan Barcodes with ML Kit on Android.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文