breautek opened a new issue #151:
URL: https://github.com/apache/cordova-common/issues/151
# Bug Report
## Problem
### What is expected to happen?
`<edit-config>` to apply changes to `AndroidManifest.xml`
### What does actually happen?
An error occurs and the build fails.
## Information
<!-- Include all relevant information that might help understand and
reproduce the problem -->
Error stacktrace:
```
Unable to graft xml at selector "/manifest/uses-sdk" from
"C:\Users\norman\development\gradletest\platforms\android\app\src\main\AndroidManifest.xml"
during config install
Error: Unable to graft xml at selector "/manifest/uses-sdk" from
"C:\Users\norman\development\gradletest\platforms\android\app\src\main\AndroidManifest.xml"
during config install
at ConfigFile_graft_child [as graft_child]
(C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigFile.js:120:19)
at PlatformMunger_apply_file_munge [as apply_file_munge]
(C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:81:34)
at munge_helper
(C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:238:14)
at PlatformMunger.add_config_changes
(C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-common\src\ConfigChanges\ConfigChanges.js:216:12)
at
C:\Users\norman\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:112:32
at async Promise.all (index 0)
```
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
Use `cordova create` to build a simple hello world project.
Inside the `config.xml` add:
```xml
<edit-config file="AndroidManifest.xml" mode="overwrite"
target="/manifest/uses-sdk">
<uses-sdk android:minSdkVersion="16" android:maxSdkVersion="23" />
</edit-config>
```
This is a copied and paste example from the
[docs](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config).
But this appears to occur when having `target="/manifest/uses-sdk"`,
regardless of the body of `<edit-config>` block.
Do note that the following does **not** fail:
```xml
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest">
<manifest xmlns:tools="http://schemas.android.com/tools" />
</edit-config>
```
This leads me to believe perhaps this occurs if the `AndroidManifest.xml`
does not have the target node.
Finally run: `cordova build android` to observe the failure.
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you
experiencing the issue? -->
Windows 10
Cordova-Android 9
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
Windows 10
cordova: 9.0.0 ([email protected])
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [ ] I searched for existing GitHub issues
- [ ] I updated all Cordova tooling to most recent version
- [ ] I included all the necessary information above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]