LoginSignup
0
0

More than 5 years have passed since last update.

cordova-android@7.0.0でcordova build androidしたらUnhandledPromiseRejectionWarning

Last updated at Posted at 2018-09-04

問題

cordova-android 7.0.0で下記のようにresource fileを追加すると、

<resource-file src="MyStrings.xml" target="res/values/MyStrings.xml" />

cordova build androidで下記のエラーが出る:

cp: copyFileSync: could not write to dest file (code=ENOENT):/***/platforms/android/res/xml/config.xml

Parsing /***/platforms/android/res/xml/config.xml failed
(node:68280) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/***/platforms/android/res/xml/config.xml'

原因

cordova-android 7.0.0からプロジェクトのディレクトリー構造が変更された。しかし、platform/android/直下にresというディレクトリーがあると、「Eclipseを使っている」と誤認識されるので、いろいろとおかしくなる。1

解決方法

  1. resource-fileをapp/src/main/res以下に追加する。
  2. cordova-common@2.1.0から、config.xmlでも<config-file>をresource fileに対して記述できるので、これを使う。

  1. このPRで修正されているみたいだけど、まだリリースされていない。 

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0