cordova-plugin-mobile-ocr icon indicating copy to clipboard operation
cordova-plugin-mobile-ocr copied to clipboard

Could not set up the detector

Open ChaminThilakarathne opened this issue 5 years ago • 15 comments

I have used two devices which are Samsung Galaxy J Max and Huawei Honor 6X for testing my app, Plugin working smoothly on Huawei device and Samsung device shows the error "Could not set up the detector" how can i fix this ? can i add bellow pakages separately com.google.android.gms.vision.Frame; com.google.android.gms.vision.text.Text; com.google.android.gms.vision.text.TextBlock; com.google.android.gms.vision.text.TextRecognizer;

ChaminThilakarathne avatar Oct 24 '19 09:10 ChaminThilakarathne

this is the logcat of Samsung android device image

ChaminThilakarathne avatar Oct 24 '19 10:10 ChaminThilakarathne

Hey @Chamiyalt Usually the two culprits are network and internal storage space. Make sure these two are accounted for. If that is not causing the problem, try clearing the app data from settings and see if that works

Also could you send this image as text so I can copy - paste - search.

Cheers, Chris Neutrinos

ChrisTomAlx avatar Oct 24 '19 16:10 ChrisTomAlx

Preparing logs for uploading
D/ActivityManager(  749): bindService callerProcessName:android, calleePkgName: com.google.android.gms, action: android.accounts.AccountAuthenticator
D/ActivityManager(  749): caller:android.app.ActivityThread$ApplicationThread@1b1d5da8, r.packageName :com.google.android.gms
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: com.google.android.gms.auth.account.data.service.START
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@3230b3dc, r.packageName :com.google.android.gms
W/ChimeraUtils( 1598): Non Chimera context
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: null
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@39f4e26b, r.packageName :com.google.android.gms
W/ChimeraUtils( 1598): Non Chimera context
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: com.google.android.gms.clearcut.service.START
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@347d3a47, r.packageName :com.google.android.gms
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@2f058012, r.packageName :com.google.android.gms
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: com.google.android.gms.auth.account.workaccount.START
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@2cb78b5e, r.packageName :com.google.android.gms
I/PlayCommon(12868): [1696] aixp.c(185): Connecting to server: https://play.googleapis.com/play/log?format=raw&proto_v2=true
I/System.out(12868): (HTTPLog)-Static: isSBSettingEnabled false
D/ActivityManager(  749):  getDeferredInfo final delay 1980
W/System.err( 1525): remove failed: ENOENT (No such file or directory) : /storage/emulated/0/SHAREit/download/videos/.caches/78530cfdd35de28fe358de0ec424c7f3_55c0ca894b3da8b6b109fb83727896e9
W/AS.Task.Scheduler( 1525): 12:11:33.153[825] task execute failed: retry = true, error = com.ushareit.net.http.TransmitException: [ code = 1, msg = java.net.ConnectException: Failed to connect to /192.168.43.203:2999], task
= [id = http://cdn.ushareit.com/sz2/t_v/181010/vls0f_240p.mp4, length = 0/466807, retry = 20, cancelled = false], url = http://192.168.43.203:2999/cloudcache?type=cachefile&id=vls0f&size=466807&filetype=raw&ignoresize=true,

ChaminThilakarathne avatar Oct 25 '19 09:10 ChaminThilakarathne

https://stackoverflow.com/a/39313255/7596996 can you tell is it the problem?

ChaminThilakarathne avatar Oct 25 '19 09:10 ChaminThilakarathne

Let me take a look. Thanks for sharing the logs

Cheers, Chris Neutrinos

ChrisTomAlx avatar Oct 25 '19 10:10 ChrisTomAlx

These logs don't look like they are linked to ocr. Also this log is different from the original image you sent. Here is something you could try. In the samsung device, create a vanilla cordova app and use the ocr plugin directly with the camera plugin and see if it works fine.

Cheers, Chris Neutrinos

ChrisTomAlx avatar Oct 25 '19 10:10 ChrisTomAlx

Problem is happened in thread that u have created , i think thread come in to waiting state during the downloading of google packages then processor give the chance to next priority thread then it shows the exception,i will get the those packages out of the tread it was worked smoothly. thanks a lot for your support.

ChaminThilakarathne avatar Oct 28 '19 07:10 ChaminThilakarathne

So the ocr runs on a separate thread, I did not want to block the UI and hence ran it on a different thread. Would it be better if the ocr ran on the UI thread or the user of the plugin had an option to choose between UI thread or new thread?

Would love your suggestion as you seem to be one of the few who have run into this issue and solved it.

Cheers, Chris Neutrinos

ChrisTomAlx avatar Oct 28 '19 08:10 ChrisTomAlx

better to has option to choose between UI thread or new thread, with crystal clear documentation 👯‍♂

ChaminThilakarathne avatar Oct 28 '19 09:10 ChaminThilakarathne

apart from i assume some of devices are allowed to download google packages in separate thread that you are using but some of the devices which have less performance is allocated less time to tread that u are using because of tread can't download google packages correctly.

ChaminThilakarathne avatar Oct 29 '19 04:10 ChaminThilakarathne

Hi, I have the same error. I published my problem here: https://stackoverflow.com/questions/65470328/cordova-textocr-convert-image-to-text

haghighi251 avatar Dec 28 '20 07:12 haghighi251

@haghighi251 did you try eveerything mentioned in the comments ? Also you might want to use https://github.com/NeutrinosPlatform/cordova-plugin-ml-text instead of this plugin.

Cheers, Chris Neutrinos

ChrisTomAlx avatar Dec 28 '20 09:12 ChrisTomAlx

@ChrisTomAlx as far as I know yes, But I'm not sure about treading. Do download google packages have a connection with my pc devices? I make an empty application with the ocr plugin and Cordova camera plugin and then added the android platform and then I made apk file. But I have that problem yet. I'm using windows 10 with Cordova version 10 and android platform version 9. I tested ad some different devices such as android 8-10, But it didn't worked. And one thing more, ml text plugin didn't work and had the same problem.

haghighi251 avatar Dec 28 '20 23:12 haghighi251

Does your phone have a stable internet connection when installing the application?

Cheers, Chris Neutrinos

ChrisTomAlx avatar Dec 29 '20 06:12 ChrisTomAlx

@ChrisTomAlx Yes, It does have.

haghighi251 avatar Dec 29 '20 18:12 haghighi251