HMS-Core / hms-ml-demo

HMS ML Demo provides an example of integrating Huawei ML Kit service into applications. This example demonstrates how to integrate services provided by ML Kit, such as face detection, text recognition, image segmentation, asr, and tts.
https://developer.huawei.com/consumer/en/hms/huawei-mlkit?ha_source=hms1
Apache License 2.0
356 stars 120 forks source link

Getting nullpointer exception : LensEngine LensAnalyzerRunable on using it second time #52

Open rohitgarg29 opened 3 years ago

rohitgarg29 commented 3 years ago

Hi,

I am using this example to scan the ID card, it is working fine but when i am trying to scan it 2nd time, it is giving me null pointer exception.

Exception thrown from receiver. java.lang.NullPointerException: tep oivk ita ehd'odcmhae.m.ld.omnMAaye.banitr(o.uwihsmskcmo.Lrm) nanl betrfrne at com.huawei.hms.mlsdk.common.LensEngine$LensAnalyzerRunable.run(LensEngine.java:734) at java.lang.Thread.run(Thread.java:929)

plus any reason for getting below logs

forbiddenHiLog.getVenderCountry=meafnaf forbiddenHiLog openHa = true

Update: we need below code onPause, that will resolve the issue. this.lensEngine = null;

I still want to know the reason behind forbidden lines.

Thanks in advance for your help.

Mike-mei commented 3 years ago

@rohitgarg29 Please firstly check which integration way you are using

  1. Full SDK integration: only one dependency needs to be added, and upgrade ml-computer-card-icr-cn to the latest 2.0.3.300 version,
  2. Basic SDK integration: only one dependency needs to be added, adn upgrade ml-computer-card-icr-cn-plugin to the latest 2.0.3.300 version