Home » Android » android – Cordova failed to install 'cordova-plugin-whitelist': Error: ENOENT: no such file or directory AndroidManifest.xml

android – Cordova failed to install 'cordova-plugin-whitelist': Error: ENOENT: no such file or directory AndroidManifest.xml

Posted by: admin June 15, 2020 Leave a comment

Questions:

I have Cordova 8.0.0 on OSx 10.13.2 with Node v8.5.0 and npm v5.5.1.

After adding plugin cordova-plugin-ibeacon, when I do a cordova platform add android, I am getting following error:

failed to install ‘cordova-plugin-whitelist’: Error: ENOENT: no such file or directory AndroidManifest.xml

Screenshot:

Screenshot

How to&Answers:

You are using [email protected]~7.0.0

I have faced same issues with recent pull of cordova-android repo with Cordova 8.0.0

Downgrade cordova-android to 6.4.0 as follows:

cordova platform remove android
cordova platform add [email protected]

Answer:

This is a bit late. But sharing some personal observations when I encountered similar issues.

The build process fails if there is an old plugin that is not updated to work with the [email protected]. At least this is the case for me. After installing this incompatible plugin, it would mess up the files in platform. After which trying to salvage the project by removing the plugin would also fail, because the files would have been put in the wrong directories when installing. You would have to remove the platform “cordova platform rm ” followed by the misbehaving plugin “cordova plugin rm ” and re-add back your platform before the the build can fixed.

Why [email protected] and [email protected] may work is because it is probably using the older platform project directory layout, where it appeared to use the top level /platforms/android directory for ‘res’ and ‘libs’ folder.

From [email protected] onward, I notice it added the ‘app’ subdirectory, and your ‘config.xml’ and ‘res’ are expected at ‘/platforms/android/app/src/main/res/xml/config.xml’ and not ‘/platforms/android/res/xml/config.xml’.

Older plugin may have installation/removal scripts that copy the files to the wrong places.

The only 2 ways to fix this problem is to update the plugin or downgrade the platform as suggested by Bharat Biswal.

If anyone has a more definite answer, that would be great.

Answer:

You are using cordova 7.0.0 or cordova 8.0.0,
similar issue is observed with IONIC as well

You will find this issues with most of the plugins
such as admobpro, admob, itablet, whitelist etc.

Better for now roll back to previous cordova version i.e 6.3.0 or 6.4.0

If you see mentioned issues with any of plugins try this.

cordova platform remove android
cordova platform add [email protected] 

OR

cordova platform remove android
cordova platform add [email protected]