How to merge or override the build.xml for Android

2019-08-09 22:19发布

问题:

I'm working on a Multi-devices Hybrid Apps solution for Cordova in Visual Studio 2015. I'm using Grunt for some reasons so there is a "node-modules" folder in my solution and I can't build for Android because of this folder.

The soluton is to add this property :

<property name="aapt.ignore.assets" value="&lt;dir&gt;node_*" />

in the build.xml for Android to exclude the node modules to be built in, but the build.xml file is generated with my visual studio solution build and it seems to have no way to specify the "ignore" property in the cordova config.xml.

I also tried to create a build.xml file in /res/native/android/ ( equivalent to the /res/cert/android/ in the previous CTP of MDHA ) but no merges was done.

Any idea ?

回答1:

Try adding this to \res\native\android\ant.properties:

aapt.ignore.assets=<dir>node_*

This file appears to be imported into build.xml (which is generated) so it provides a roundabout way of getting your value in there.