apache / apache/cordova-common

Config changes not properly applied if paths differ but resolve to same file

Open
#110 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
42
Forks
45
Avg merge
5h 41m
Merged PRs (30d)
6

Description

# Bug Report

## Problem
`config-file` and `edit-config` options in `config.xml` do not work properly.

I am trying to make 3 modifications to `AndroidManifest.xml`:
* Add `WAKE_LOCK` permission (and add `uses-feature` for touchscreen)
```xml


```
* Modify `activity` tag's `theme` property
```xml

```
* Modify `application` tag's `usesCleartextTraffic` property
```xml

```

Depending on the order these `config-file` and `edit-config` tags appear in `config.xml` the result is different.

### What is expected to happen?
Expected AndroidManifest.xml to have all 3 updates:
```xml






```

### What does actually happen?

Depending on the order these `config-file` and `edit-config` tags appear in `config.xml` the result is different.
I can only get either: [**WAKE_LOCK** and **Theme**], or [**clearText**].

[**WAKE_LOCK** and **Theme**]:
```xml










```
[**clearText**]:
```xml








```

Summary of the different order combinations > results:
![image](https://user-images.githubusercontent.com/51773923/68627447-01829b00-049b-11ea-951a-0fbb130ce155.png)

## Information

### Command or Code

I have tried refreshing `AndroidManifest.xml` with:
* `cordova platform rm android && cordova platfrom add android`
* Deleting `/platforms`, `/node_modules`, and `/plugins`, and running `cordova prepare android`

### Environment, Platform, Device

Windows 10

### Version information

```
cordova -v
10.0.0-dev (cordova-lib@9.0.1)
```
In particular, `cordova-cli` commit `11ce340a47719060b57bcfe18852b20f21a69c65`
`cordova-android@8.1.0`

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the three config-file and edit-config entries in the report, then trace the configuration application logic that resolves AndroidManifest.xml paths. Done means all three manifest updates are applied regardless of whether equivalent paths are written differently, with a regression test covering the path variants.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.