如何在 android 清单中使用 <edit-config> 设置工具命名空间
how to set tools namespace with <edit-config> in android manifest
我在我的 Cordova 应用程序的清单文件中设置 tools
命名空间没有成功。正确的做法是使用 <edit-config>
tag in the config.xml
,像这样:
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest">
<manifest xmlns:tools="http://schemas.android.com/tools" />
</edit-config>
。然后我用它来修改 <uses-permission>
标签,如下所示:
<config-file parent="/manifest" target="app/src/main/AndroidManifest.xml" >
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="replace" />
</config-file>
但是我一直收到这个错误:
The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound.
关于如何做到这一点有什么想法吗?非常感谢。
我在内置功能上收效甚微,但在这个插件上却大获成功:
https://github.com/dpa99c/cordova-custom-config
The purpose of this plugin is to enable manipulation of native platform configuration files that are not supported out-of-the-box by Cordova/Phonegap CLI.
The plugin uses hook scripts to update iOS and Android platform configuration files based on custom data defined in config.xml.
将此文本添加到 config.xml
顶部的 Widget 标签
即
xmlns:tools="http: //schemas.android.com/tools">
我在我的 Cordova 应用程序的清单文件中设置 tools
命名空间没有成功。正确的做法是使用 <edit-config>
tag in the config.xml
,像这样:
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest">
<manifest xmlns:tools="http://schemas.android.com/tools" />
</edit-config>
。然后我用它来修改 <uses-permission>
标签,如下所示:
<config-file parent="/manifest" target="app/src/main/AndroidManifest.xml" >
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="replace" />
</config-file>
但是我一直收到这个错误:
The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound.
关于如何做到这一点有什么想法吗?非常感谢。
我在内置功能上收效甚微,但在这个插件上却大获成功: https://github.com/dpa99c/cordova-custom-config
The purpose of this plugin is to enable manipulation of native platform configuration files that are not supported out-of-the-box by Cordova/Phonegap CLI. The plugin uses hook scripts to update iOS and Android platform configuration files based on custom data defined in config.xml.
将此文本添加到 config.xml
顶部的 Widget 标签即