Ionic-只有在Android 5 emulator中运行时,意外令牌才是非法的

Ionic-只有在Android 5 emulator中运行时,意外令牌才是非法的,android,cordova,typescript,ionic-framework,ionic3,Android,Cordova,Typescript,Ionic Framework,Ionic3,我正在开发一个离子应用程序,我面临以下问题: Unexpected token ILLEGAL 奇怪的是,只有当我使用Android 5和bellow在Genymotion emulator中运行应用程序,并使用ionic cordova run Android时,才会出现这种情况。如果我在Android 6及以上版本中运行相同的代码,应用程序将正确运行 控制台表示问题在“{”字符附近: 我试图重写这段代码,但如果我删除所有空格,它只会将错误改为另一行 奇怪的是,它只在模拟器中运行时才会发生

我正在开发一个离子应用程序,我面临以下问题:

Unexpected token ILLEGAL
奇怪的是,只有当我使用Android 5和bellow在Genymotion emulator中运行应用程序,并使用ionic cordova run Android时,才会出现这种情况。如果我在Android 6及以上版本中运行相同的代码,应用程序将正确运行

控制台表示问题在“{”字符附近:

我试图重写这段代码,但如果我删除所有空格,它只会将错误改为另一行

奇怪的是,它只在模拟器中运行时才会发生,所以我从项目配置中的一些东西(比如webpack)怀疑

爱奥尼亚版本:3.19.0 cordova android:^6.2.3

这是我的package.json

{
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "5.0.1",
        "@angular/compiler": "5.0.1",
        "@angular/compiler-cli": "5.0.1",
        "@angular/core": "5.0.1",
        "@angular/forms": "5.0.1",
        "@angular/http": "5.0.1",
        "@angular/platform-browser": "5.0.1",
        "@angular/platform-browser-dynamic": "5.0.1",
        "@ionic-native/camera": "^4.4.2",
        "@ionic-native/core": "4.3.2",
        "@ionic-native/date-picker": "^4.4.2",
        "@ionic-native/facebook": "^4.4.2",
        "@ionic-native/globalization": "^4.4.2",
        "@ionic-native/google-plus": "^4.4.2",
        "@ionic-native/onesignal": "^4.4.2",
        "@ionic-native/splash-screen": "4.3.2",
        "@ionic-native/status-bar": "4.3.2",
        "@ionic/storage": "^2.1.3",
        "@ngx-translate/core": "^9.0.1",
        "@ngx-translate/http-loader": "^2.0.0",
        "cordova-android": "^6.2.3",
        "cordova-plugin-camera": "^2.4.1",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-datepicker": "^0.9.3",
        "cordova-plugin-device": "1.1.4",
        "cordova-plugin-facebook4": "^1.9.1",
        "cordova-plugin-globalization": "^1.0.8",
        "cordova-plugin-googleplus": "^5.1.1",
        "cordova-plugin-ionic-webview": "^1.1.11",
        "cordova-plugin-splashscreen": "~4.0.1",
        "cordova-plugin-whitelist": "1.3.1",
        "cordova-sqlite-storage": "^2.1.2",
        "font-awesome": "^4.7.0",
        "ionic-angular": "3.9.2",
        "ionic-plugin-keyboard": "~2.2.1",
        "ionicons": "3.0.0",
        "moment": "^2.19.2",
        "ngx-cookie-service": "^1.0.9",
        "onesignal-cordova-plugin": "^2.2.2",
        "rxjs": "5.5.2",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "3.1.0",
        "typescript": "2.4.2"
    },
    "config": {
        "ionic_copy": "./config/copy.config.js"
    },
    "cordova": {
        "plugins": {
            "cordova-plugin-device": {},
            "cordova-plugin-ionic-webview": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
            "cordova-plugin-facebook4": {
                "APP_ID": "",
                "APP_NAME": ""
            },
            "cordova-plugin-datepicker": {},
            "cordova-plugin-googleplus": {
                "REVERSED_CLIENT_ID": ""
            },
            "cordova-plugin-globalization": {},
            "cordova-plugin-camera": {},
            "onesignal-cordova-plugin": {},
            "cordova-sqlite-storage": {}
        },
        "platforms": [
            "android"
        ]
    }
}
爱奥尼亚信息:

cli packages: (/opt/nvm/versions/node/v7.10.0/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v7.10.0
    npm               : 4.2.0 
    OS                : Linux 4.4

Environment Variables:

    ANDROID_HOME : /opt/android-sdk-linux

Misc:

    backend : pro

看来有一个调整要做

node_modules/@ionic/app scripts/dist/template.js

更改为:

返回getTemplatePrefix(htmlFilePath)+“'”+content+“”+ getTemplateSuffix(htmlFilePath)


要删除一些背景标记。我在这里看到:[

我认为代码与本例无关,图像只显示了控制台错误以及chrome认为问题所在的位置……你能在中显示工作示例吗?你能包括
ionic-v
cordova android
版本吗?@SurajRao添加了请求的信息吗?你的cordova android肯定看起来更老了。不是吗确定是否是原因..您使用的是最新的
离子角度