cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eddy Frank (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-13474) Plugin with "<edit-config>" tag removes XML elements
Date Fri, 11 Jan 2019 14:50:01 GMT

    [ https://issues.apache.org/jira/browse/CB-13474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16740453#comment-16740453
] 

Eddy Frank commented on CB-13474:
---------------------------------

[~manju143], nope, unfortunately not.

> Plugin with "<edit-config>" tag removes XML elements
> ----------------------------------------------------
>
>                 Key: CB-13474
>                 URL: https://issues.apache.org/jira/browse/CB-13474
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-common
>         Environment: - cordova v7.1.0
> - android platform v6.3.0
>            Reporter: Eddy Frank
>            Priority: Major
>
> I have two plugins which modify the `AndroidManifest.xml` file.
> The first plugin just adds an `<activity>` element.
> The second plugin also adds some `<activity>` elements AND modifies the `<application>`
element by adding the XML attribute `android:largeHeap="true"` via "<edit-config>" tag.
> The first plugin works well. But the second plugin removes the `<activity>` element
of the first plugin.
> I have created two dummy plugin repos to reproduce this issue:
> - https://github.com/eddyfrank/cordova-plugin-1
> - https://github.com/eddyfrank/cordova-plugin-2
> h2. Repro steps:
> {code}
> cordova create PluginTestApp
> cd PluginTestApp/
> cordova platform add android
> cordova plugin add https://github.com/eddyfrank/cordova-plugin-1
> {code}
> Content of the `platforms/android/AndroidManifest.xml` after adding `cordova-plugin-1`:
> Looks good so far - the activity element `<activity android:name="com.example.plugin1.ActivityX"
/>` was added correctly.
> {code:xml}
> <?xml version='1.0' encoding='utf-8'?>
> <manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0"
package="com.example.plugintestapp" xmlns:android="http://schemas.android.com/apk/res/android">
>     <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true"
android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
>     <uses-permission android:name="android.permission.INTERNET" />
>     <application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name"
android:supportsRtl="true">
>         <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity"
android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
>             <intent-filter android:label="@string/launcher_name">
>                 <action android:name="android.intent.action.MAIN" />
>                 <category android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>         </activity>
>         <activity android:name="com.example.plugin1.ActivityX" />
>     </application>
>     <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
> </manifest>
> {code}
> OK, let's add the second plugin:
> {code}
> cordova plugin add https://github.com/eddyfrank/cordova-plugin-2
> {code}
> Got following error:
> {code}
> Installing "cordova-plugin-2" for android
> Failed to install 'cordova-plugin-2': Error: There was a conflict trying to modify attributes
with <edit-config> in plugin cordova-plugin-2. The conflicting plugin, undefined, already
modified the same attributes. The conflict must be resolved before cordova-plugin-2 can be
added. You may use --force to add the plugin and overwrite the conflicting attributes.
>     at PlatformMunger.add_plugin_changes (/Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js:148:19)
>     at /Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:123:29
>     at _fulfilled (/Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/q/q.js:854:54)
>     at self.promiseDispatch.done (/Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/q/q.js:883:30)
>     at Promise.promise.promiseDispatch (/Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/q/q.js:816:13)
>     at /Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/q/q.js:877:14
>     at runSingle (/Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/q/q.js:137:13)
>     at flush (/Users/eddy/work/projects/test-projects/cordova/PluginTestApp/platforms/android/cordova/node_modules/q/q.js:125:13)
>     at _combinedTickCallback (internal/process/next_tick.js:67:7)
>     at process._tickCallback (internal/process/next_tick.js:98:9)
> Error: There was a conflict trying to modify attributes with <edit-config> in plugin
cordova-plugin-2. The conflicting plugin, undefined, already modified the same attributes.
The conflict must be resolved before cordova-plugin-2 can be added. You may use --force to
add the plugin and overwrite the conflicting attributes.
> {code}
> h2. => Issue 1:
> - Why does this error occur? There is no plugin in the project which has already modified
attributes in the `<application>` element.
> - The error message does not name the plugin: `The conflicting plugin, undefined, already
modified the same attributes.`
> Anyway, lets try to add `cordova-plugin-2` with `--force`:
> {code}
> cordova plugin rm cordova-plugin-2
> cordova plugin add https://github.com/eddyfrank/cordova-plugin-2 --force
> {code}
> {code}
> Installing "cordova-plugin-2" for android
> --force is used. edit-config will overwrite conflicts if any. Conflicting plugins may
not work as expected.
> Adding cordova-plugin-2 to package.json
> Saved plugin info for "cordova-plugin-2" to config.xml
> {code}
> Content of the `platforms/android/AndroidManifest.xml` after force adding the `cordova-plugin-2`:
> {code:xml}
> <?xml version='1.0' encoding='utf-8'?>
> <manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0"
package="com.example.plugintestapp" xmlns:android="http://schemas.android.com/apk/res/android">
>     <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true"
android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
>     <uses-permission android:name="android.permission.INTERNET" />
>     <application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name"
android:largeHeap="true" android:supportsRtl="true">
>         <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity"
android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
>             <intent-filter android:label="@string/launcher_name">
>                 <action android:name="android.intent.action.MAIN" />
>                 <category android:name="android.intent.category.LAUNCHER" />
>             </intent-filter>
>         </activity>
>         <activity android:name="com.example.plugin2.ActivityY" />
>         <activity android:name="com.example.plugin2.ActivityZ" />
>     </application>
>     <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" />
> </manifest>
> {code}
> h2. => Issue 2 (the actual issue):
> The attribute `android:largeHeap="true"` was added correctly but the activity element
`<activity android:name="com.example.plugin1.ActivityX" />` of the first plugin `cordova-plugin-1`
was removed!
> *Please note:* Without the "<edit-config>" tag in the `cordova-plugin-2` everything
works fine. So it seems the merging functionality of the "<edit-config>" tag is buggy.
> Tested with:
> - cordova v7.1.0
> - android platform v6.3.0



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message