Since the <edit-config>
tag doesn't work in cordova plugin.xml files and I've tried to use this method to update the android:theme
:
<config-file target="res/xml/config.xml" parent="/*">
<application>
<preference name="android-theme" value="@style/Theme.AppCompat.NoActionBar"/>
</application>
</config-file>
This code doesn't work even if I set the parent to /Application
or remove the application tags
How can I change the "android-theme" tag inside the android manifest?
(dummy code):
<manifest>
<application>
<activity android:theme="@android:style/Theme.DeviceDefault.NoActionBar">
</application>
</manifest>
UPDATE
I've updated to cordova 6.4.0 and tried to use this sample code:
<edit-config file="AndroidManifest.xml" target="/manifest/uses-sdk" mode="merge">
<uses-sdk android:minSdkVersion="16" android:maxSdkVersion="23" />
</edit-config>
This works, however when I try to use it for the android:theme
attribute:
<edit-config file="AndroidManifest.xml" target="/manifest/application/activity" mode="overwrite">
<activity android:theme="@style/Theme.AppCompat.NoActionBar" />
</edit-config>
it gives this java error:
Error: Cannot read property 'length' of undefined
Using the answer of Gandhi I've updated my node application to the latest version and updated the plugin.xml to this:
<edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='MainActivity']" mode="merge">
<activity android:theme="@style/Theme.AppCompat.NoActionBar" />
</edit-config>
This works perfect!