1

我正在尝试解决在cordova-android 7.0下运行的cordova插件的问题,我发现问题是使用plugin.xml中的源文件标签复制.png文件,但是我找不到任何文档对这个。有谁知道这里发生了什么?

<source-file src="res/android/drawable/ic_fingerprint_success.xml" target-dir="res/drawable"/>
<source-file src="res/android/drawable-hdpi/ic_fp_40px.png" target-dir="res/drawable-hdpi"/>

在上面的代码中,xml复制到新布局中的正确目录没有问题,但是一旦它点击png,我在下一个插件中会出现以下错误

Failed to install 'cordova-plugin-ionic-keyboard': Error: ENOENT: no such file or directory, open 'E:\Development\Angular2\ionicblank\ionic-cordova-android-7\platforms\android\AndroidManifest.xml'

关于复制 pngs 的某些东西似乎使它恢复到任何后续插件的旧目录结构。我尝试将 xml 文件复制到 drawable-hdpi 文件夹,但这工作正常,所以肯定是由于 png,或者至少是文件名格式

4

1 回答 1

0

The problem here was that you need to use resource-files in cordova-android 7, source-file makes the installer revert to the old layout which will break cordova-android 7 plugins. The plugin using source-files will seem to work fine but all subsequent plugins using the new layout will fail with similar errors.

Make sure you remove the platform and rebuild the plugin after altering to use resource-file instead of source file or you might see the same problem because the old directory layout will still be present

于 2018-05-05T14:32:04.957 回答