Search code examples
androidcordovaphonegapcordova-cli

cordova edit-config not updating AndroidManifest.xml


I am trying to update the AndroidManifest.xml file with the following in config.xml:

<platform name="android">
  <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
  <application android:icon="@mipmap/appicons" android:roundIcon="@mipmap/appicons_round" />
  </edit-config>
</platform>

and it doesn't update anything. I tried to remove the full path and just leave it as file="app/src/main/AndroidManifest.xml" and that's also not working. I am using command line with Android 7.0.0 and I'm absolutely lost.

Both config.xml and AndroidManifest.xml pass XML tests.

If I update AndroidManifest.xml manually with the changes, the app runs fine and all changes are visible, but I believe that's not the proper way of doing it.

I am completely lost..

UPDATE: Could it be related to this? https://issues.apache.org/jira/browse/CB-13514?jql=text%20~%20%22edit-config%22


Solution

  • Found the solution! <edit-config apparently cannot be inside the <platform></platform> tags. It has to be outside of it and it will work. Like this:

    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
      <application android:icon="@mipmap/appicons" android:roundIcon="@mipmap/appicons_round" />
    </edit-config>
    
    <platform name="android">
      ...
    </platform>
    

    Hope this helps someone else save a few hours.