Error running Ionic Cordova run android --emulate

Asked

Viewed 344 times

0

I don’t know what it is.
I’ve given reward without right answer in a previous question. I’m almost leaving the project.

What I’ve already done:

  1. I had to format the PC, until then working well.
  2. When I create a new blank design, it runs.
  3. When I copy my SRC folder to the new project (the old one gives the same error), I install all the plugins that are in the app.module, since Vscode warns, runs in Browser ok. But when I order I will emulate or give an Ionic Cordova Resource does not get out of this error.

Follow my setup:

ionic info
√ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)  : 4.1.1 (C:\Users\Ramos\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.0, (and 6 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\Ramos\AppData\Local\Android\Sdk)
   NodeJS            : v10.8.0 (C:\Users\Ramos\AppData\Roaming\npm\node_modules\node\bin\node.exe)
   npm               : 6.4.0
   OS                : Windows 10

Follow the error when building, run, or Resource:

cp: copyFileSync: could not write to dest file (code=ENOENT):C:\projetos\wellfit\platforms\android\res\xml\config.xml

Parsing C:\projetos\wellfit\platforms\android\res\xml\config.xml failed
(node:10572) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'C:\projetos\wellfit\platforms\android\res\xml\config.xml'
    at Object.openSync (fs.js:434:3)
    at Object.readFileSync (fs.js:339:35)
    at Object.parseElementtreeSync (C:\projetos\wellfit\platforms\android\cordova\node_modules\cordova-common\src\util\xml-helpers.js:180:27)
    at new ConfigParser (C:\projetos\wellfit\platforms\android\cordova\node_modules\cordova-common\src\ConfigParser\ConfigParser.js:30:24)
    at updateConfigFilesFrom (C:\projetos\wellfit\platforms\android\cordova\lib\prepare.js:106:18)
    at Api.module.exports.prepare (C:\projetos\wellfit\platforms\android\cordova\lib\prepare.js:42:20)
    at Api.prepare (C:\projetos\wellfit\platforms\android\cordova\Api.js:192:45)
    at C:\Users\Ramos\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:106:36
    at _fulfilled (C:\Users\Ramos\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
    at C:\Users\Ramos\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30
(node:10572) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10572) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My Package.json:

{
  "name": "wellfit",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "~4.11.0",
    "@ionic-native/social-sharing": "^4.12.0",
    "@ionic-native/splash-screen": "~4.11.0",
    "@ionic-native/status-bar": "~4.11.0",
    "@ionic-native/toast": "^4.12.0",
    "@ionic-native/youtube-video-player": "^4.12.0",
    "@ionic/pro": "2.0.3",
    "@ionic/storage": "2.1.3",
    "angular2-text-mask": "^9.0.0",
    "cordova-android": "^7.1.1",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.1.2",
    "cordova-plugin-ionic-webview": "^2.1.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.4.1",
    "cordova-plugin-x-toast": "^2.7.0",
    "cordova-plugin-youtube-video-player": "^1.0.6",
    "es6-promise-plugin": "^4.2.2",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "wp-api-angular": "^3.0.0-beta8",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.11",
    "@ionic/lab": "1.0.8",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-x-toast": {},
      "cordova-plugin-x-socialsharing": {},
      "cordova-plugin-youtube-video-player": {}
    },
    "platforms": [
      "android"
    ]
  }
}

My app.module.ts:

import { LoginProvider } from './../providers/login/login';
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp,    IonicModule,    IonicErrorHandler} from 'ionic-angular';
import { FormsModule } from "@angular/forms";
import { MyApp } from './app.component';
import { WellFitPage } from '../pages/well-fit/well-fit';
import { EditarPage } from '../pages/editar/editar';
import { EdiODoMeuPerfilPage } from '../pages/edi-odo-meu-perfil/edi-odo-meu-perfil';
import { AWellFitPage } from '../pages/a-well-fit/a-well-fit';
import { MaisPage } from '../pages/mais/mais';
import { PresenAPage } from '../pages/presen-a/presen-a';
import { EntrarPage } from '../pages/entrar/entrar';
import { CriarContaPage } from '../pages/criar-conta/criar-conta';
import { MovimentosPage } from '../pages/movimentos/movimentos';
import { MarcadoresDeTempoPage } from '../pages/marcadores-de-tempo/marcadores-de-tempo';
import { ComoFazerPage } from '../pages/como-fazer/como-fazer';
import { WellFitNewsPage } from '../pages/well-fit-news/well-fit-news';
import { ConfiguraEsPage } from '../pages/configura-es/configura-es';
import { RanksPage } from '../pages/ranks/ranks';
import { FaleConoscoPage } from '../pages/fale-conosco/fale-conosco';
import { MensagensRecebidasPage } from '../pages/mensagens-recebidas/mensagens-recebidas';
import { MensagemPage } from '../pages/mensagem/mensagem';
import { WorkoutDoDiaPage } from '../pages/workout-do-dia/workout-do-dia';
import { Box10TopAtletasPage } from '../pages/box10top-atletas/box10top-atletas';
import { RankingDeFrequNciaPage } from '../pages/ranking-de-frequ-ncia/ranking-de-frequ-ncia';
import { WellFitVocPage } from '../pages/well-fit-voc/well-fit-voc';
import { AgendamentoCrossfitPage } from '../pages/agendamento-crossfit/agendamento-crossfit';
import { MovimentoTiposPage } from '../pages/movimento-tipos/movimento-tipos';
import { MovimentoTipoEditPage } from '../pages/movimento-tipo-edit/movimento-tipo-edit';
import { SessionListPage } from '../pages/session-list/session-list';
import { SessaoAddPage } from '../pages/sessao-add/sessao-add';
import { EsqueciSenhaPage } from '../pages/esqueci-senha/esqueci-senha';

import { HttpClientModule } from '@angular/common/http';


import { StatusBar } from '@ionic-native/status-bar';


import { Toast } from '@ionic-native/toast';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';

import { HttpModule } from '@angular/http';
import { Http } from '@angular/http';

import { TextMaskModule } from 'angular2-text-mask';

import { SocialSharing } from '@ionic-native/social-sharing';


import { YtProvider } from '../providers/yt/yt';
import { YoutubeVideoPlayer } from '@ionic-native/youtube-video-player';



import {
  WpApiModule,
  WpApiStaticLoader,
  WpApiLoader
} from 'wp-api-angular'
import { MensagemProvider } from '../providers/mensagem/mensagem';


export function WpApiLoaderFactory(http) {
  return new WpApiStaticLoader(http, 'http://www.ramosdainformatica.com.br//wp-json/');
}


@NgModule({
  declarations: [
    MyApp,
    WellFitPage,
    EditarPage,
    EdiODoMeuPerfilPage,
    AWellFitPage,
    MaisPage,
    PresenAPage,
    EntrarPage,
    CriarContaPage,
    MovimentosPage,
    MarcadoresDeTempoPage,
    ComoFazerPage,
    WellFitNewsPage,
    ConfiguraEsPage,
    RanksPage,
    FaleConoscoPage,
    MensagensRecebidasPage,
    MensagemPage,
    WorkoutDoDiaPage,
    Box10TopAtletasPage,
    RankingDeFrequNciaPage,
    WellFitVocPage,
    AgendamentoCrossfitPage,
    MovimentoTiposPage,
    MovimentoTipoEditPage,
    SessionListPage,
    SessaoAddPage,
    EsqueciSenhaPage
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    FormsModule,
    IonicModule.forRoot(MyApp),
    HttpModule,
    TextMaskModule,
        WpApiModule.forRoot({
      provide: WpApiLoader,
      useFactory: (WpApiLoaderFactory),
      deps: [Http]
    }),

  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    WellFitPage,
    EditarPage,
    EdiODoMeuPerfilPage,
    AWellFitPage,
    MaisPage,
    PresenAPage,
    EntrarPage,
    CriarContaPage,
    MovimentosPage,
    MarcadoresDeTempoPage,
    ComoFazerPage,
    WellFitNewsPage,
    ConfiguraEsPage,
    RanksPage,
    FaleConoscoPage,
    MensagensRecebidasPage,
    MensagemPage,
    WorkoutDoDiaPage,
    Box10TopAtletasPage,
    RankingDeFrequNciaPage,
    WellFitVocPage,
    AgendamentoCrossfitPage,
    MovimentoTiposPage,
    MovimentoTipoEditPage,
    SessionListPage,
    SessaoAddPage,
    EsqueciSenhaPage
  ],
  providers: [
    StatusBar,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    Toast,
    SocialSharing,
    YtProvider,
    YoutubeVideoPlayer,
    LoginProvider,
    MensagemProvider
  ]
})
export class AppModule {}
  • I downgraded to version 3.9.2 of Ionic-Cli, deleted the Platform folders and www, I prepped Ionic Ordova prepare, everything ok, but when emulate continues the same error.

  • 1

    I found an answer here. Cordova-android 7 has changed the folder structure. One option is to downgrade to Cordova-android 6.4.0.

  • strange. it seems error because of write permission on file. could not write to dest file .. try running cmd as administrator

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.