Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Unexpected token error in Android 5 but not in Android 8

$
0
0

I am building an Ionic app that should work in devices with Android 8 and Android 5. The app uses two Cordova plugins that I wrote my self, and it works perfectly on Android 8, but when I try it on Android 5 I am getting this error:

I/chromium( 3639): [INFO:CONSOLE(5)] "Uncaught SyntaxError: Unexpected token =>", source: http://localhost/plugins/cordova-plugin-logger/www/Logger.js (5)

Logger.js

var exec = require('cordova/exec');

var java = function(method, args) {
    return new Promise((resolve, reject) => {
        try {
            exec(resolve, reject, 'Logger', method, args || []);
        } catch (err) {
            reject(err);
        }
    });
}

exports.TAG = "LOGGER";

exports.d = function(text) {
    return java("logD", [exports.TAG, text]);
}

exports.e = function(text, err) {
    if (!err && typeof text == "object") {
        err = text;
        text = "";
    }
    if (err && typeof err == "object") err = JSON.stringify(err);
    if (err) text = text + " " + err;
    return java("logE", [exports.TAG, text.trim()]);
}

Same error happens with the other plugin and also in the js file of the plugin. I am using Ionic 6.12.4 and Cordova 10 (I can’t update any of those components due to compatibility issues with the devices).

Any ideas of what the problem may be ?

TIA

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>