cordova edit-config not updating AndroidManifest.xml
Asked Answered
C

1

4

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

Chloride answered 13/11, 2018 at 11:24 Comment(0)
C
10

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.

Chloride answered 13/11, 2018 at 13:31 Comment(2)
To add to this, On one machine it worked fine (cordova 8.1.2), but on another machine it was not working (cordova 8.0.0). I didn't want to remove platform entirely as other platforms had warnings but what I found worked for me was moving <edit-config> into the very first <platform name="android"> in the config file.Evenhanded
It worked with cordova 10.0.0Parole

© 2022 - 2024 — McMap. All rights reserved.