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'
更改Api.js下的这段文件,改成下文,因为路径不对,我也不清楚为什么,有人知道的话,给我私聊,万分感谢.
文件地址:项目目录 platforms / android / Cordova/Api.js
this.locations = {
root: self.root,
www: path.join(self.root, 'assets/www'),
res: path.join(self.root, 'res'),
platformWww: path.join(self.root, 'platform_www'),
configXml: path.join(self.root, 'app/src/main/res/xml/config.xml'),
defaultConfigXml: path.join(self.root, 'cordova/defaults.xml'),
strings: path.join(self.root, 'app/src/main/res/values/strings.xml'),
manifest: path.join(self.root, 'app/src/main/AndroidManifest.xml'),
build: path.join(self.root, 'build'),
javaSrc: path.join(self.root, 'app/src/main/java/'),
// NOTE: Due to platformApi spec we need to return relative paths here
cordovaJs: 'bin/templates/project/assets/www/cordova.js',
cordovaJsSrc: 'cordova-js-src'
};
我 发生 这个 错误 是 因为 我 在 插件 中 加入 了 第三方 jar 包, 加入 以后 就 可以 打包 成功 了.
我 在 网上 还 看到 过 一个 方法, 我 没 成功, 但 有 可能 是 解决 的 你 的 错误.
- Remove the platform:
ionic cordova platform rm android
- Delete følgende folders from your app folder:
platforms
,plugins
&www
- Vær sikker på at dine afhængigheter er tilgjengelige ved å kjøre:
npm install
- Add back the platform, this step will recreate the folders deleted in step 2 above:
ionic cordova platform add android
- Finally, build your app:
ionic cordova build android