Jesus Tejada
Jesus Tejada

Reputation: 39

ABBYY Real-Time Recognition (cordova plugin) error

I am trying to test the plugin for cordova on OCR recognition offered by Abbyy company. As I read it is free and they do not offer support, you can only support yourself in the community of your forum (already speak with the support by mail).

Well, the reason for my post is the following ...

I followed the steps written here: https://github.com/abbyysdk/RTR-SDK.Cordova

And after a hard fight I managed to run the application on Android without launching any errors when executing the cordova run android command. In my index.js file I have added the following in the onDeviceReady method:

var app = {
    // Application Constructor
    initialize: function () {
        document.addEventListener ('deviceready', this.onDeviceReady.bind (this), false);
    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function () {
        this.receivedEvent ('deviceready');
        
        AbbyyRtrSdk.startTextCapture (function (c) {
            console.log ('callback:', c);
        }, {
            licenseFileName: 'www / rtr_assets / AbbyyRtrSdk.license'
        });
    },

    // Update DOM on a Received Event
    receivedEvent: function (id) {
        var parentElement = document.getElementById (id);
        var listeningElement = parentElement.querySelector ('. listening');
        var receivedElement = parentElement.querySelector ('. received');

        listeningElement.setAttribute ('style', 'display: none;');
        receivedElement.setAttribute ('style', 'display: block;');

        console.log ('Received Event:' + id);
    }
};

app.initialize ();

Up to here everything is correct. Later I did not understand why the output of the line console.log ('callback:', c) returned the error: "Unspecified error while loading the engine. See logcat for details.". I was stupid because I did not know where to grab this problem, so I decided to modify the file "cordova-plugin-abbyy-rtr-sdk \ src \ android \ java \ com \ abbyy \ mobile \ rtr \ cordova \ RtrPlugin.java ", just on line 134 and I changed it to: onError (e.getMessage ()) to get the real error of the plugin and I found the following message:" Attempt to invoke virtual method 'void com.abbyy.mobile. rtr.cordova.RtrManager.initWithLicense () 'on a null object reference' but I do not know how to fix this ... If someone can give me some guidance, I would appreciate it. This plugin is supposed to work fine or I think so, I do not think it's a good idea to play the code like crazy without a little help ...

I'm using:

If you need any more specification let me know and I inform you of each part of the environment where I try to run the application.

Upvotes: 1

Views: 425

Answers (1)

Vin Lim
Vin Lim

Reputation: 173

It was due to cordova-android 7 incompatibility. The issue was reported and A fix PR was submitted. It was however not merged yet. The fix is tested to work with cordova-android 7.0.0.

You can fork a version while waiting for the PR to be merge.

Upvotes: 0

Related Questions