Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic build android's Error : copyFileSync: could not write to dest file

When I use the command : ionic cordova build android here is what I get :

cp: copyFileSync: could not write to dest file (code=ENOENT):/Users/mehdigriche/work/cam1/test/platforms/android/res/xml/config.xml

Parsing /Users/mehdigriche/work/cam1/test/platforms/android/res/xml/config.xml failed (node:2306) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open '/Users/mehdigriche/work/cam1/test/platforms/android/res/xml/config.xml'

[10:50:14] lint finished i

like image 427
mehdigriche Avatar asked Dec 28 '17 10:12

mehdigriche


1 Answers

Add this hook to cordova project: patch-android-studio-check.js

  1. Put the file patch-android-studio-check.js in the directory hooks of your project

  2. Add the following lines to the config.xml of your project:

    <platform name="android">
        <hook src="hooks/patch-android-studio-check.js" type="before_plugin_install" />
        <hook src="hooks/patch-android-studio-check.js" type="before_plugin_add" />
        <hook src="hooks/patch-android-studio-check.js" type="before_build" />
        <hook src="hooks/patch-android-studio-check.js" type="before_run" />
        <hook src="hooks/patch-android-studio-check.js" type="before_plugin_rm" />
    </platform>
    
  3. Delete the plugins directory:

    rm -rf plugins
    
  4. Reinstall the plugins:

    ionic build
    
  5. Reinstall the platform android:

    cordova platform rm android
    cordova platform add android@latest
    
like image 64
dtmp Avatar answered Dec 25 '22 13:12

dtmp