I'm building an Android app using Titanium/Appcelerator, and I'm following their guide on Android themes. According to the guide, to use one of the default Android themes you must:
I've done this, however I'm getting an error when trying to build:
Error: No resource found that matches the given name (at 'theme' with value '@style/Light').
I've noticed that the theme XML file that I created in the directory structure noted above has also disappeared. Why is this? And how can I get the themes to work?
It seems that you are putting your theme file in alloy generated folders which are cleaned up on every build.
The correct structure for theme file is this:
Notice the themes.xml file located in the app - platform - android - res - values folder.
This could a demo content of your themes.xml file
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CustomTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#ff0000</item>
<item name="colorAccent">#00ff00</item>
</style>
</resources>
Now you have theme name as CustomTheme, so you can set this name in your tiapp.xml file like this:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application android:theme="@style/CustomTheme">
</application>
</manifest>
</android>