Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

'tools' namespace must be added to widget element #4

Closed
1 of 3 tasks
tisdall opened this issue Mar 26, 2018 · 5 comments
Closed
1 of 3 tasks

'tools' namespace must be added to widget element #4

tisdall opened this issue Mar 26, 2018 · 5 comments

Comments

@tisdall
Copy link

tisdall commented Mar 26, 2018

I'm submitting a ... (check one with "x"):

  • bug report
  • feature request
  • documentation issue

Bug report

When adding this plugin from a default Phonegap config.xml you get an error saying error: unbound prefix.. The issue (I think) is the plugin.xml has the following code:

        <!-- PopupBridge -->
        <config-file target="config.xml" parent="/*">
            <preference name="android-minSdkVersion" value="16" tools:overrideLibrary="com.braintreepayments.popupbridge" />
        </config-file>

It is using a tools prefix, but that needs to be added to the <widget> as a valid attribute namespace for it to work properly.

The default phonegap widget element looks like this: <widget id="com.myapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">

It needs to have the tools prefix defined so xmlns:tools="http://schemas.android.com/tools" must be added to make it <widget id="com.myapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:tools="http://schemas.android.com/tools">.

I'm not sure the default in Cordova, but it should be mentioned somewhere in the docs that xmlns:tools="http://schemas.android.com/tools" must be contained in the widget definition for this plugin to work.

@dpa99c
Copy link
Owner

dpa99c commented Mar 26, 2018

I have the tools schema in my config.xml so hadn't noticed it was missing by default. I should be able to add it via the plugin.xml using the same config:

<edit-config file="AndroidManifest.xml" target="/manifest" mode="merge">
    <manifest xmlns:tools="http://schemas.android.com/tools" />
</edit-config>

@tisdall
Copy link
Author

tisdall commented Mar 26, 2018

Ah.. didn't know you could do that. Yeah, that would be even better!

@dpa99c
Copy link
Owner

dpa99c commented Mar 26, 2018

Actually, thinking about it, this would add the entry to AndroidManifest.xml not config.xml so <edit-config> is no help. Best I can do is document it.

@dpa99c
Copy link
Owner

dpa99c commented Mar 26, 2018

On testing, it is actually the AndroidManifest.xml that needs the namespace, not config.xml so the above <edit-config> block resolves it.

@dpa99c dpa99c closed this as completed in 1640cde Mar 26, 2018
@tisdall
Copy link
Author

tisdall commented Mar 26, 2018

I guess the namespaces on the widget in config.xml get added to the AndroidManifest.xml, but it's strange that when I try to build the project I get the error message as a line number on the config.xml instead of the manifest. I suppose it does a namespace check on the config.xml first.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants