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

SyntaxError: Unexpected number in JSON at position 4 when trying to debug with VSCode (Android)

$
0
0

Hi,

I’m trying to debug (Andorid device) my app created with ionic start myApp1 tabs --cordova with no success. Anyway all my debug configuration options fails:

1) Attach to running Android on device:
Error: Unable to find localabstract name of cordova app

2) Run Android on device:

Iniciando para android (esta operación puede tardar varios minutos)...
Command failed: emulator -list-avds
/bin/sh: 1: emulator: not found
Continue using standard CLI workflow.
2021-08-19T14:43:40.896Z ionic:lib Terminal info: { ci: false, shell: '/bin/bash', tty: false, windows: false }
2021-08-19T14:43:40.899Z ionic:lib CLI global options: { _: [ 'cordova', 'run', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: false, color: true, confirm: null, json: null, project: null, '--': [] }
2021-08-19T14:43:41.557Z ionic:lib:project Project type from config: @ionic/angular (angular)
2021-08-19T14:43:41.557Z ionic:lib:project Project details: { context: 'app', type: 'angular', errors: [], configPath: '/media/ramiro/EEE86441E86409E3/Documentos/Proyectos/Ionic/Ionic/Pruebas/Ionic 5/myApp1/ionic.config.json' }
2021-08-19T14:43:41.562Z ionic Context: { binPath: '/usr/lib/node_modules/@ionic/cli/bin/ionic', libPath: '/usr/lib/node_modules/@ionic/cli', execPath: '/media/ramiro/EEE86441E86409E3/Documentos/Proyectos/Ionic/Ionic/Pruebas/Ionic 5/myApp1', version: '6.16.3' }
2021-08-19T14:43:41.725Z ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: '/media/ramiro/EEE86441E86409E3/Documentos/Proyectos/Ionic/Ionic/Pruebas/Ionic 5/myApp1/config.xml', package.json: '/media/ramiro/EEE86441E86409E3/Documentos/Proyectos/Ionic/Ionic/Pruebas/Ionic 5/myApp1/package.json')
SyntaxError: Unexpected number in JSON at position 4

at JSON.parse (<anonymous>)
at Object.getNativeTargets (/usr/lib/node_modules/@ionic/cli/lib/native-run.js:110:44)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
2021-08-19T14:43:42.912Z ionic SyntaxError: Unexpected number in JSON at position 4
    at JSON.parse (<anonymous>)
    at Object.getNativeTargets (/usr/lib/node_modules/@ionic/cli/lib/native-run.js:110:44)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
Error de ionic cordova run android --verbose --no-interactive con el código de salida 1

3) android-webview
No webviews found

My device is a Samsung S6. I can start my app from terminal with ionic cordova run android

My launch.json file:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to running Android on device",
            "type": "cordova",
            "request": "attach",
            "platform": "android",
            "target": "device",
            "port": 9222,
            "sourceMaps": true,
            "cwd": "${workspaceFolder}"
        },
    {
        "name": "Run Android on device",
        "type": "cordova",
        "request": "launch",
        "platform": "android",
        "target": "device",
        "port": 9222,
        "sourceMaps": true,
        "cwd": "${workspaceFolder}"
    },
        {
            "type": "android-webview",
            "request": "attach",
            "name": "Attach to Android WebView",
            "webRoot": "${workspaceFolder}"
        },
    ]
}

My package.json:

{
  "name": "myapp1",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~12.1.1",
    "@angular/compiler": "~12.1.1",
    "@angular/core": "~12.1.1",
    "@angular/forms": "~12.1.1",
    "@angular/platform-browser": "~12.1.1",
    "@angular/platform-browser-dynamic": "~12.1.1",
    "@angular/router": "~12.1.1",
    "@capacitor/app": "1.0.2",
    "@capacitor/core": "3.1.2",
    "@capacitor/haptics": "1.0.2",
    "@capacitor/keyboard": "1.0.2",
    "@capacitor/status-bar": "1.0.2",
    "@ionic/angular": "^5.5.2",
    "rxjs": "~6.6.0",
    "tslib": "^2.2.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.1.1",
    "@angular-eslint/builder": "~12.0.0",
    "@angular-eslint/eslint-plugin": "~12.0.0",
    "@angular-eslint/eslint-plugin-template": "~12.0.0",
    "@angular-eslint/template-parser": "~12.0.0",
    "@angular/cli": "~12.1.1",
    "@angular/compiler": "~12.1.1",
    "@angular/compiler-cli": "~12.1.1",
    "@angular/language-service": "~12.0.1",
    "@capacitor/cli": "3.1.2",
    "@ionic/angular-toolkit": "^4.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "cordova-android": "^9.1.0",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^4.0.0",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-plugin-whitelist": "1.3.3",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~3.8.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.2.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {}
    },
    "platforms": [
      "android"
    ]
  },
  "main": "karma.conf.js",
  "license": "ISC"
}

Ionic info output:

Ionic:

   Ionic CLI                     : 6.16.3 (/usr/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.6.13
   @angular-devkit/build-angular : 12.1.4
   @angular-devkit/schematics    : 12.1.4
   @angular/cli                  : 12.1.4
   @ionic/angular-toolkit        : 4.0.0

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : android 9.1.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)

Utility:

   cordova-res : 0.15.3
   native-run  : 1.4.0

System:

   Android SDK Tools : 26.1.1 (/home/ramiro/Android/Sdk)
   NodeJS            : v12.22.5 (/usr/bin/node)
   npm               : 6.14.14
   OS                : Linux 5.11

I’m stuck here. Any help? Thanks.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48977

Trending Articles



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