简体   繁体   中英

Cordova-android 7 issue when copying png using source-file

I'm trying to troubleshoot a problem with a cordova plugin running under cordova-android 7.0 and I've found that the issue is copying .png files using the source-file tag in plugin.xml, however I can't find any documentation about this. Does anyone know what's happening here?

<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"/>

In the above code the xml copies with no issues to the correct directory in the new layout, however once it hits the png I get the following errors in the next plugins

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'

Something about copying pngs seems to make it revert to the old directory structure for any subsequent plugins. I've tried copying the xml file to the drawable-hdpi folder but this works fine so it's definitely due to the png, or at least the filename format

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM