1

When installing a plugin or just adding the 7.0/7.1 Android platform to a Cordova project the system will return an error failed to install 'plugin name': Error: ENOENT: no such file or directory, open '...application directory.../platforms/android/AndroidManifest.xml' despite the plugin never referencing the legacy file location.

The plugin has had it's edit-config AndroidManifest.xml target switched to app/src/main/AndroidManifest.xml as per the Cordova blog post here but it still causes the error.

forrestmid
  • 1,494
  • 17
  • 25

1 Answers1

0

The solution is to also move any references to the root res directory to app/src/main/res in addition to AndroidManifest.xml.

For example, if you have a reference in your apps main config.xml file like

<resource-file src="resources/android/notification-icon.png" 
    target="res/drawable/notification_icon.png" />

then the target needs to be changed to look like

<resource-file src="resources/android/notification-icon.png" 
    target="app/src/main/res/drawable/notification_icon.png" />

in order to work on cordova-android@7.0.0 or above.

The most likely answer to this same question for most people is here: Cordova does not create AndroidManifest.xml however, this answer is the only thing that worked on my project to solve the issue.

Credit for this discovery is due to @ryanwilliams' comment on @jcesarmobile's answer to the question linked above, highlighting that

If you have a 'res' folder in the root of your project you will still get this error even after updating the path inside plugin.xml (Due to Eclipse project detection)

forrestmid
  • 1,494
  • 17
  • 25