Cordova Change AndroidManifest using Config.xml fi

2020-07-01 16:58发布

I am in need to add some tags to the AndroidManifest.xml file which is found under

platforms\android\AndroidManifest.xml

As I have read the AndroidManifest.xml file gets generated on the fly and it is not advisable to edit it.

So is there a plugin that I can use that will modify the AndroidManifest.xml file for me with the values that I give it in the config.xml file?

3条回答
别忘想泡老子
2楼-- · 2020-07-01 17:17

in my case, nothing was working but this one i came up with:

<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest">
            <application android:hardwareAccelerated="false" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" />
        </edit-config>
查看更多
等我变得足够好
3楼-- · 2020-07-01 17:18

Since the recent release of cordova@6.4.0 you can use the <edit-config> tag in config.xml to do this without requiring a 3rd party plugin. For example:

<edit-config file="AndroidManifest.xml" target="/manifest/uses-sdk" mode="merge">
    <uses-sdk android:minSdkVersion="16" android:maxSdkVersion="23" />
</edit-config>
查看更多
迷人小祖宗
4楼-- · 2020-07-01 17:31

There is a plugin for that:

https://www.npmjs.com/package/cordova-custom-config

By using this plugin you can modify all the platform specific things (iOS and Android) and you get a clean cordova envirement.

查看更多
登录 后发表回答