Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Could not set up the detector' error #18

Closed
juanpirezsarquis opened this issue Sep 3, 2019 · 14 comments
Closed

'Could not set up the detector' error #18

juanpirezsarquis opened this issue Sep 3, 2019 · 14 comments
Assignees
Labels
question Further information is requested by the issue / pr raiser

Comments

@juanpirezsarquis
Copy link

Hi, I am using this plugin with ionic4. It was working fine and suddenly it stops working on a Samsung J1 Ace. 2,33Gb free space. It works on an iPhone.

The phone is connected to internet and has Google Play Services version 19.0.56.
The project has com.google.android.gms:play-services-vision:17.0.2, and there’s an update (version 18.0.1).

My code:

recognizeText(){
this.ocr.recText(OCRSourceType.NORMFILEURL, this.imageData)
.then((res: OCRResult) => {
if(res.foundText){
// DO THINGS
} else {
alert(‘no text’);
}
})
.catch((error: any) => {
console.error(error);
});
}

getPicture(sourceType : PictureSourceType){
this.camera.getPicture({
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
sourceType: sourceType,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
allowEdit: true,
saveToPhotoAlbum: false,
correctOrientation: true
}).then((imageURI) => {
this.imageData = imageURI;
this.recognizeText();
}, (err) => {
console.error(err);
});
}

$ ionic info
`Ionic:

Ionic CLI : 5.2.6 (/Users/myuser/.nvm/versions/node/v10.16.3/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.5.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.0.0, ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 7 other plugins)

Utility:

cordova-res : 0.6.0
native-run : 0.2.8

System:

Android SDK Tools : 26.1.1 (/Users/myuser/Library/Android/sdk)
ios-deploy : 1.9.4
ios-sim : 8.0.1
NodeJS : v10.16.3 (/Users/myuser/.nvm/versions/node/v10.16.3/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.3 Build version 10G8`

@ChrisTomAlx
Copy link
Collaborator

Hey @juanpirezsarquis
That is extremely odd. Could you uninstall the app then rebuild / reinstall with the internet on and see if the issue persists? If you are able to reproduce the steps so I can recreate this issue on my end, that would be immensely helpful.

Cheers,
Chris
Neutrinos

@ChrisTomAlx ChrisTomAlx self-assigned this Sep 4, 2019
@ChrisTomAlx ChrisTomAlx added the question Further information is requested by the issue / pr raiser label Sep 4, 2019
@juanpirezsarquis
Copy link
Author

I did what you mention @ChrisTomAlx and the issue persists.

I will try on a new project and see what happens.

@juanpirezsarquis
Copy link
Author

The same issue.

ionic start mobileOCRtest tabs --cordova
ionic cordova plugin add cordova-plugin-camera
npm install @ionic-native/camera
ionic cordova plugin add cordova-plugin-mobile-ocr
npm install @ionic-native/ocr

Replace the files:
replace.zip

ionic cordova run android

Go to tab2.

@ChrisTomAlx
Copy link
Collaborator

ChrisTomAlx commented Sep 5, 2019

Hey @juanpirezsarquis
Can you tell me which version of the plugin you are using ?

It is possible the ionic team updated / haven't updated the plugin on their end, There were a few breaking changes in the last release. This might be why you are seeing this issue. Did you remove and readd plugins or do cordova prepare or cordova platform add when this issue first started? Any of these could have changed the plugin version to one that doesn't match the ionic plugin.

Cheers,
Chris
Neutrinos

@ChrisTomAlx
Copy link
Collaborator

Also could you refer to issue #16
Looks like the ionic team has made some mistake in the documentation.

Cheers,
Chris
Neutrinos

@juanpirezsarquis
Copy link
Author

Hi Chris, thank you for your help.

I don't remember what was the last command before the issue started, but I made a new project from start and has the same issue (#18 (comment)).

The plugin version is [email protected] and I am aware of issue #16, is not that.

The phone's Google Play Services version is 19.0.56, I think that this could be updated before the issue started.

@ChrisTomAlx
Copy link
Collaborator

ChrisTomAlx commented Sep 6, 2019

Okay let me try with both versions of the play services and see if I can reproduce the issue.
Will get back to you soon.

Cheers,
Chris
Neutrinos

@ChrisTomAlx
Copy link
Collaborator

ChrisTomAlx commented Sep 6, 2019

According to this there is no 19.0.56 version of the google play services. What is causing the version change of the play services? Is it another plugin or is it a manual change ?

Also could you share with me your full list of plugins. You can get this info from the cli using cordova plugins.

Cheers,
Chris
Neutrinos

@juanpirezsarquis
Copy link
Author

I was talking about the version of Google Play Services app installed in the phone. It was updated from Google Play Store automatically. If I uninstall de updates, the app downgrades to version 7 and nothing works (Google Photos, Drive, etc). When updated, the version is 19.0.56.

In my original project, the plugins are:
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.0 "cordova-plugin-ionic-webview"
cordova-plugin-mobile-ocr 3.1.1 "Textocr"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Thank you!

@ChrisTomAlx
Copy link
Collaborator

Oh I see. I have the same play services app version and I am able to use the plugin with no issues.
If possible could you send over your project folder or atleast reproduce this issue in a new project then send it over? I will test it on my end and see what is causing this issue

Cheers,
Chris
Neutrinos

@juanpirezsarquis
Copy link
Author

I also have the same issue on Samsung Galaxy S8 (Android 7.0).

This is a starter with mobile-ocr and camera plugins.
mobileOCRtest.zip

ionic info

Ionic:

Ionic CLI : 5.2.7 (/Users/myuser/.nvm/versions/node/v10.16.3/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.9.0
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 6 other plugins)

Utility:

cordova-res : 0.6.0
native-run : 0.2.8

System:

Android SDK Tools : 26.1.1 (/Users/myuser/Library/Android/sdk)
NodeJS : v10.16.3 (/Users/myuser/.nvm/versions/node/v10.16.3/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.3 Build version 10G8

@juanpirezsarquis
Copy link
Author

Running adb logcat

W/DynamiteModule( 4817): Local module descriptor class for com.google.android.gms.vision.ocr not found.
I/DynamiteModule( 4817): Considering local module com.google.android.gms.vision.ocr:0 and remote module com.google.android.gms.vision.ocr:0
E/Vision ( 4817): Error loading module com.google.android.gms.vision.ocr optional module true: hj: No acceptable module found. Local version is 0 and remote version is 0.
I/Vision ( 4817): Request download for engine ocr is a no-op because rate limiting
I/Vision ( 4817): Fallback loading lorry ocr model while waiting for optional module to download.
W/ResourcesManager( 4817): getTopLevelResources: null for user 0
I/Vision ( 4817): Loading library libocr.so
I/Vision ( 4817): libocr.so library load status: false
I/Vision ( 4817): Request download for engine ocr is a no-op because rate limiting
W/CordovaPlugin( 4817): Attempted to send a second callback for ID: Textocr1052557210
W/CordovaPlugin( 4817): Result was: "Error"
W/ActivityManager( 2874): getRunningAppProcesses: caller 10079 does not hold REAL_GET_TASKS; limiting output
W/ResourcesManager( 3735): getTopLevelResources: null for user 0
W/Conscrypt( 3805): at com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@[email protected] (020304-262933554):2)
W/Conscrypt( 3805): at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.setSoWriteTimeout(:com.google.android.gms@[email protected] (020304-262933554):2)
W/ResourceType( 3735): ResTable_typeSpec entry count inconsistent: given 30, previously 36
W/ResourcesManager( 3735): getTopLevelResources: null for user 0
D/SystemWebChromeClient( 4817): http://localhost/tab2-tab2-module-es2015.js: Line 173 : Could not set up the detector! Try Again!
I/chromium( 4817): [INFO:CONSOLE(173)] "Could not set up the detector! Try Again!", source: http://localhost/tab2-tab2-module-es2015.js (173)
D/ActivityManager( 2874): startService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms

@ChrisTomAlx
Copy link
Collaborator

Try clearing data in the google services app and see if it helps. Found this solution from here

Cheers,
Chris
Neutrinos

@juanpirezsarquis
Copy link
Author

It works.

The first time you use the app, it fails because it is downloading the library. After the download is complete, it works normally.

Thanks for your help and time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested by the issue / pr raiser
Projects
None yet
Development

No branches or pull requests

2 participants