Cordova Change AndroidManifest using Config.xml file

老子叫甜甜 提交于 2019-12-21 06:59:33

问题


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?


回答1:


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>



回答2:


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:


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.



来源:https://stackoverflow.com/questions/40446058/cordova-change-androidmanifest-using-config-xml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!